Mercurial > hg > orthanc-ohif
annotate Sources/OrthancExplorer.js @ 30:36049c04ee27
update year to 2024
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Jan 2024 15:20:42 +0100 |
parents | e8dea04df69b |
children | 5f8d66f7fa06 |
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 |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
93 // 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
|
94 $('#dialog').simpledialog2({ |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
95 mode: 'blank', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
96 animate: false, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
97 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
|
98 headerClose: true, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
99 forceInput: false, |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
100 width: '100%', |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
101 blankContent: viewers |
eab054ee7537
added modal in Orthanc Explorer to choose between the OHIF viewers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
6
diff
changeset
|
102 }); |
0 | 103 }); |
104 } | |
105 }); | |
106 }); | |
6
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
107 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
108 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
109 if (${USE_DICOM_WEB}) { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
110 $('#lookup').live('pagebeforeshow', function() { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
111 $('#open-ohif-study-list').remove(); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
112 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
113 var b = $('<fieldset>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
114 .attr('id', 'open-ohif-study-list') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
115 .addClass('ui-grid-b') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
116 .append($('<div>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
117 .addClass('ui-block-a')) |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
118 .append($('<div>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
119 .addClass('ui-block-b') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
120 .append($('<a>') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
121 .attr('id', 'coucou') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
122 .attr('data-role', 'button') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
123 .attr('href', '#') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
124 .attr('data-icon', 'forward') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
125 .attr('data-theme', 'a') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
126 .text('Open OHIF study list') |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
127 .button() |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
128 .click(function(e) { |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
129 window.open('../ohif/'); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
130 }))); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
131 |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
132 b.insertAfter($('#lookup-result')); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
133 }); |
e8e7ba4371e3
fix access to OHIF study list
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5
diff
changeset
|
134 } |