comparison Sources/OrthancExplorer.js @ 7:eab054ee7537

added modal in Orthanc Explorer to choose between the OHIF viewers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 18 Jun 2023 10:37:21 +0200
parents e8e7ba4371e3
children e8dea04df69b
comparison
equal deleted inserted replaced
6:e8e7ba4371e3 7:eab054ee7537
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 **/ 22 **/
23 23
24 24
25 function AddOhifViewer(target, name, callback) {
26 var li = $('<li>', {
27 name: name,
28 }).click(callback);
29
30 li.append($('<a>', {
31 href: '#',
32 rel: 'close',
33 text: name
34 }));
35
36 target.append(li);
37 }
38
39
25 $('#study').live('pagebeforeshow', function() { 40 $('#study').live('pagebeforeshow', function() {
26 var studyId = $.mobile.pageData.uuid; 41 var studyId = $.mobile.pageData.uuid;
27 42
28 $.ajax({ 43 $.ajax({
29 url: '../studies/' + studyId, 44 url: '../studies/' + studyId,
41 .attr('data-theme', 'e') 56 .attr('data-theme', 'e')
42 .text('Open OHIF viewer') 57 .text('Open OHIF viewer')
43 .button(); 58 .button();
44 59
45 b.insertAfter($('#study-info')); 60 b.insertAfter($('#study-info'));
61
46 b.click(function() { 62 b.click(function() {
47 if (${USE_DICOM_WEB}) { 63 var viewers = $('<ul>')
48 window.open('../ohif/viewer?StudyInstanceUIDs=' + studyInstanceUid); 64 .attr('data-divider-theme', 'd')
49 } else { 65 .attr('data-role', 'listview');
50 window.open('../ohif/viewer?url=../ohif-source/' + studyId); 66
51 } 67 // The list of OHIF viewers can be found at: https://docs.ohif.org/
68
69 AddOhifViewer(viewers, 'Basic viewer', function() {
70 if (${USE_DICOM_WEB}) {
71 window.open('../ohif/viewer?StudyInstanceUIDs=' + studyInstanceUid);
72 } else {
73 window.open('../ohif/viewer?url=../ohif-source/' + studyId);
74 }
75 });
76
77 AddOhifViewer(viewers, 'Volume rendering', function() {
78 if (${USE_DICOM_WEB}) {
79 window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&StudyInstanceUIDs=' + studyInstanceUid);
80 } else {
81 window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&url=../ohif-source/' + studyId);
82 }
83 });
84
85 AddOhifViewer(viewers, 'Total metabolic tumor volume', function() {
86 if (${USE_DICOM_WEB}) {
87 window.open('../ohif/tmtv?StudyInstanceUIDs=' + studyInstanceUid);
88 } else {
89 window.open('../ohif/tmtv?url=../ohif-source/' + studyId);
90 }
91 });
92
93 // Launch the dialog
94 $('#dialog').simpledialog2({
95 mode: 'blank',
96 animate: false,
97 headerText: 'Choose OHIF viewer',
98 headerClose: true,
99 forceInput: false,
100 width: '100%',
101 blankContent: viewers
102 });
52 }); 103 });
53 } 104 }
54 }); 105 });
55 }); 106 });
56 107