Mercurial > hg > orthanc-ohif
annotate Sources/OrthancExplorer.js @ 39:a63247d45917
simplification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 Mar 2024 16:05:51 +0100 |
parents | 5f8d66f7fa06 |
children |
rev | line source |
---|---|
0 | 1 /** |
30 | 2 * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium |
0 | 3 * SPDX-License-Identifier: GPL-3.0-or-later |
4 */ | |
5 | |
6 /** | |
7 * OHIF plugin for Orthanc | |
30 | 8 * Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium |
0 | 9 * |
10 * This program is free software: you can redistribute it and/or | |
11 * modify it under the terms of the GNU General Public License as | |
12 * published by the Free Software Foundation, either version 3 of the | |
13 * License, or (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, but | |
16 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 * General Public License for more details. | |
19 * | |
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/>. | |
22 **/ | |
23 | |
24 | |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
25 function AddOhifViewer(target, name, callback) { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
26 var li = $('<li>', { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
27 name: name, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
28 }).click(callback); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
29 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
30 li.append($('<a>', { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
31 href: '#', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
32 rel: 'close', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
33 text: name |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
34 })); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
35 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
36 target.append(li); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
37 } |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
38 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
39 |
0 | 40 $('#study').live('pagebeforeshow', function() { |
41 var studyId = $.mobile.pageData.uuid; | |
42 | |
43 $.ajax({ | |
44 url: '../studies/' + studyId, | |
45 dataType: 'json', | |
46 success: function(s) { | |
47 var studyInstanceUid = s.MainDicomTags.StudyInstanceUID; | |
48 | |
49 $('#ohif-button').remove(); | |
50 | |
51 var b = $('<a>') | |
52 .attr('id', 'ohif-button') | |
53 .attr('data-role', 'button') | |
54 .attr('href', '#') | |
55 .attr('data-icon', 'search') | |
56 .attr('data-theme', 'e') | |
57 .text('Open OHIF viewer') | |
58 .button(); | |
59 | |
60 b.insertAfter($('#study-info')); | |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
61 |
0 | 62 b.click(function() { |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
63 var viewers = $('<ul>') |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
64 .attr('data-divider-theme', 'd') |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
65 .attr('data-role', 'listview'); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
66 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
67 // The list of OHIF viewers can be found at: https://docs.ohif.org/ |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
68 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
69 AddOhifViewer(viewers, 'Basic viewer', function() { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
70 if (${USE_DICOM_WEB}) { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
71 window.open('../ohif/viewer?StudyInstanceUIDs=' + studyInstanceUid); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
72 } else { |
9
e8dea04df69b
caching OHIF dicom-json as metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
7
diff
changeset
|
73 window.open('../ohif/viewer?url=../studies/' + studyId + '/ohif-dicom-json'); |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
74 } |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
75 }); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
76 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
77 AddOhifViewer(viewers, 'Volume rendering', function() { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
78 if (${USE_DICOM_WEB}) { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
79 window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&StudyInstanceUIDs=' + studyInstanceUid); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
80 } else { |
9
e8dea04df69b
caching OHIF dicom-json as metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
7
diff
changeset
|
81 window.open('../ohif/viewer?hangingprotocolId=mprAnd3DVolumeViewport&url=../studies/' + studyId + '/ohif-dicom-json'); |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
82 } |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
83 }); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
84 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
85 AddOhifViewer(viewers, 'Total metabolic tumor volume', function() { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
86 if (${USE_DICOM_WEB}) { |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
87 window.open('../ohif/tmtv?StudyInstanceUIDs=' + studyInstanceUid); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
88 } else { |
9
e8dea04df69b
caching OHIF dicom-json as metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
7
diff
changeset
|
89 window.open('../ohif/tmtv?url=../studies/' + studyId + '/ohif-dicom-json'); |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
90 } |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
91 }); |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
92 |
36
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
93 AddOhifViewer(viewers, 'Segmentation', function() { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
94 if (${USE_DICOM_WEB}) { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
95 window.open('../ohif/segmentation?StudyInstanceUIDs=' + studyInstanceUid); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
96 } else { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
97 window.open('../ohif/segmentation?url=../studies/' + studyId + '/ohif-dicom-json'); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
98 } |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
99 }); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
100 |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
101 AddOhifViewer(viewers, 'Microscopy', function() { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
102 if (${USE_DICOM_WEB}) { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
103 window.open('../ohif/microscopy?StudyInstanceUIDs=' + studyInstanceUid); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
104 } else { |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
105 window.open('../ohif/microscopy?url=../studies/' + studyId + '/ohif-dicom-json'); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
106 } |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
107 }); |
5f8d66f7fa06
Enabled support for segmentation and microscopy modes
Alain Mazy <am@osimis.io>
parents:
30
diff
changeset
|
108 |
7
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
109 // Launch the dialog |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
110 $('#dialog').simpledialog2({ |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
111 mode: 'blank', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
112 animate: false, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
113 headerText: 'Choose OHIF viewer', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
114 headerClose: true, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
115 forceInput: false, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
116 width: '100%', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
117 blankContent: viewers |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
118 }); |
0 | 119 }); |
120 } | |
121 }); | |
122 }); | |
6
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
123 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
124 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
125 if (${USE_DICOM_WEB}) { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
126 $('#lookup').live('pagebeforeshow', function() { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
127 $('#open-ohif-study-list').remove(); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
128 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
129 var b = $('<fieldset>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
130 .attr('id', 'open-ohif-study-list') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
131 .addClass('ui-grid-b') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
132 .append($('<div>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
133 .addClass('ui-block-a')) |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
134 .append($('<div>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
135 .addClass('ui-block-b') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
136 .append($('<a>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
137 .attr('id', 'coucou') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
138 .attr('data-role', 'button') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
139 .attr('href', '#') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
140 .attr('data-icon', 'forward') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
141 .attr('data-theme', 'a') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
142 .text('Open OHIF study list') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
143 .button() |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
144 .click(function(e) { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
145 window.open('../ohif/'); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
146 }))); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
147 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
148 b.insertAfter($('#lookup-result')); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
149 }); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
150 } |