annotate OrthancStone/Samples/RtViewerPlugin/OrthancExplorer.js @ 1527:4c4b267e4004

RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
author Benjamin Golinvaux <bgo@osimis.io>
date Sun, 02 Aug 2020 15:13:58 +0200
parents
children de8cf5859e84
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1527
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 $('#series').live('pagebeforecreate', function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 var b = $('<a>')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 .attr('data-role', 'button')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 .attr('href', '#')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 .attr('data-icon', 'search')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 .attr('data-theme', 'e')
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 .text('Stone MPR RT Viewer');``
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 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
10 b.click(function() {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 if ($.mobile.pageData) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 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
14 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 success: function(series) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 // 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
19 // current one.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20 // 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
21 // 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
22 // 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
23 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
24
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 url: '../studies/' + series.ParentStudy,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
27 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 success: function(study) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 // 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
31 // if any.
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 let rtStructInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 let rtDoseInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 let rtPetInstance = null;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 let seriesRequests = []
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 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
38 let request = $.ajax({
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 url: '../series/' + studySeriesUuid,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 dataType: 'json',
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
41 cache: false,
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
42 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 seriesRequests.push(request);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 });
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 $.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
47 [].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
48 siblingSeries = response[0]
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49 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
50 // 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
51 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
52 if(rtDoseInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
53 rtDoseInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 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
58 // 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
59 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
60 if(rtPetInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 rtPetInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62 }
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 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 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
66 // 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
67 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
68 if(rtStructInstance == null) {
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 rtStructInstance = siblingSeries.Instances[0];
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
70 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 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
75 '&rtdose=' + rtDoseInstance +
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 '&rtstruct=' + rtStructInstance;
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 //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
78 window.open(mprViewerUrl);
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 }
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 }
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 });
4c4b267e4004 RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87