annotate Applications/Samples/RtViewerPlugin/OrthancExplorer.js @ 1870:3889ae96d2e9

added copyright UCLouvain
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jan 2022 11:04:09 +0100
parents 9ac2a65d4172
children 7053b8a0aaec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
1 /**
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
2 * Stone of Orthanc
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
1870
3889ae96d2e9 added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
7 *
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
8 * This program is free software: you can redistribute it and/or
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
9 * modify it under the terms of the GNU Affero General Public License
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
11 * the License, or (at your option) any later version.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
12 *
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
13 * This program is distributed in the hope that it will be useful, but
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
16 * Affero General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1589
diff changeset
17 *
1589
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
18 * You should have received a copy of the GNU Affero General Public License
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
20 **/
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
21
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
22
1527
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 $('#series').live('pagebeforecreate', function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 var b = $('<a>')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 .attr('data-role', 'button')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 .attr('href', '#')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 .attr('data-icon', 'search')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 .attr('data-theme', 'e')
1537
de8cf5859e84 removing useless docker-build.sh from the two plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1527
diff changeset
29 .text('Stone MPR RT Sample Viewer');``
1527
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 b.insertBefore($('#series-delete').parent().parent());
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 b.click(function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 if ($.mobile.pageData) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 url: '../series/' + $.mobile.pageData.uuid,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 success: function(series) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 // we consider that the imaging series to display is the
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 // current one.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 // we will look for RTDOSE and RTSTRUCT instances in the
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 // sibling series from the same study. The first one of
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 // each modality will be grabbed.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45 let ctSeries = $.mobile.pageData.uuid;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 url: '../studies/' + series.ParentStudy,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 success: function(study) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 // Loop on the study series and find the first RTSTRUCT and RTDOSE instances,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 // if any.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 let rtStructInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 let rtDoseInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 let rtPetInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 let seriesRequests = []
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 study.Series.forEach( function(studySeriesUuid) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 let request = $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 url: '../series/' + studySeriesUuid,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 seriesRequests.push(request);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 $.when.apply($,seriesRequests).then(function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 [].forEach.call(arguments, function(response) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 siblingSeries = response[0]
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 if (siblingSeries.MainDicomTags.Modality == "RTDOSE") {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 // we have found an RTDOSE series. Let's grab the first instance
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 if (siblingSeries.Instances.length > 0) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 if(rtDoseInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 rtDoseInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 if (siblingSeries.MainDicomTags.Modality == "PT") {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 // we have found an RTDOSE series. Let's grab the first instance
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 if (siblingSeries.Instances.length > 0) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 if(rtPetInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 rtPetInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 if (siblingSeries.MainDicomTags.Modality == "RTSTRUCT") {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88 // we have found an RTDOSE series. Let's grab the first instance
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 if (siblingSeries.Instances.length > 0) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 if(rtStructInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 rtStructInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 let mprViewerUrl = '../stone-rtviewer/index.html?ctseries=' + ctSeries +
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 '&rtdose=' + rtDoseInstance +
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 '&rtstruct=' + rtStructInstance;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 //console.log("About to open: " + mprViewerUrl);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100 window.open(mprViewerUrl);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
101 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
102 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109