annotate Applications/Samples/RtViewerPlugin/OrthancExplorer.js @ 1589:8c5f9864545f

adding missing headers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Oct 2020 16:59:23 +0200
parents d1806b4e4839
children 4fb8fdf03314
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
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
6 *
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
7 * 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
8 * 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
9 * 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
10 * the License, or (at your option) any later version.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
11 *
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
12 * 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
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
15 * Affero General Public License for more details.
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
16 *
8c5f9864545f adding missing headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
17 * 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
18 * 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
19 **/
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
1527
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 $('#series').live('pagebeforecreate', function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 var b = $('<a>')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 .attr('data-role', 'button')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 .attr('href', '#')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 .attr('data-icon', 'search')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 .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
28 .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
29
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 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
31 b.click(function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 if ($.mobile.pageData) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 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
35 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 success: function(series) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 // 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
40 // current one.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 // 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
42 // 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
43 // 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
44 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
45
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 url: '../studies/' + series.ParentStudy,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 success: function(study) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
51 // 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
52 // if any.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 let rtStructInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 let rtDoseInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 let rtPetInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 let seriesRequests = []
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 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
59 let request = $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 url: '../series/' + studySeriesUuid,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 seriesRequests.push(request);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 });
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 $.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
68 [].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
69 siblingSeries = response[0]
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 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
71 // 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
72 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
73 if(rtDoseInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 rtDoseInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 }
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 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
79 // 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
80 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
81 if(rtPetInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 rtPetInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 }
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 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
87 // 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
88 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
89 if(rtStructInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 rtStructInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 }
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 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
96 '&rtdose=' + rtDoseInstance +
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 '&rtstruct=' + rtStructInstance;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98 //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
99 window.open(mprViewerUrl);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100 });
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