comparison 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
comparison
equal deleted inserted replaced
1526:61023b0d39c8 1527:4c4b267e4004
1 $('#series').live('pagebeforecreate', function() {
2 var b = $('<a>')
3 .attr('data-role', 'button')
4 .attr('href', '#')
5 .attr('data-icon', 'search')
6 .attr('data-theme', 'e')
7 .text('Stone MPR RT Viewer');``
8
9 b.insertBefore($('#series-delete').parent().parent());
10 b.click(function() {
11 if ($.mobile.pageData) {
12 $.ajax({
13 url: '../series/' + $.mobile.pageData.uuid,
14 dataType: 'json',
15 cache: false,
16 success: function(series) {
17
18 // we consider that the imaging series to display is the
19 // current one.
20 // we will look for RTDOSE and RTSTRUCT instances in the
21 // sibling series from the same study. The first one of
22 // each modality will be grabbed.
23 let ctSeries = $.mobile.pageData.uuid;
24
25 $.ajax({
26 url: '../studies/' + series.ParentStudy,
27 dataType: 'json',
28 cache: false,
29 success: function(study) {
30 // Loop on the study series and find the first RTSTRUCT and RTDOSE instances,
31 // if any.
32 let rtStructInstance = null;
33 let rtDoseInstance = null;
34 let rtPetInstance = null;
35 let seriesRequests = []
36
37 study.Series.forEach( function(studySeriesUuid) {
38 let request = $.ajax({
39 url: '../series/' + studySeriesUuid,
40 dataType: 'json',
41 cache: false,
42 });
43 seriesRequests.push(request);
44 });
45
46 $.when.apply($,seriesRequests).then(function() {
47 [].forEach.call(arguments, function(response) {
48 siblingSeries = response[0]
49 if (siblingSeries.MainDicomTags.Modality == "RTDOSE") {
50 // we have found an RTDOSE series. Let's grab the first instance
51 if (siblingSeries.Instances.length > 0) {
52 if(rtDoseInstance == null) {
53 rtDoseInstance = siblingSeries.Instances[0];
54 }
55 }
56 }
57 if (siblingSeries.MainDicomTags.Modality == "PT") {
58 // we have found an RTDOSE series. Let's grab the first instance
59 if (siblingSeries.Instances.length > 0) {
60 if(rtPetInstance == null) {
61 rtPetInstance = siblingSeries.Instances[0];
62 }
63 }
64 }
65 if (siblingSeries.MainDicomTags.Modality == "RTSTRUCT") {
66 // we have found an RTDOSE series. Let's grab the first instance
67 if (siblingSeries.Instances.length > 0) {
68 if(rtStructInstance == null) {
69 rtStructInstance = siblingSeries.Instances[0];
70 }
71 }
72 }
73 });
74 let mprViewerUrl = '../stone-rtviewer/index.html?ctseries=' + ctSeries +
75 '&rtdose=' + rtDoseInstance +
76 '&rtstruct=' + rtStructInstance;
77 //console.log("About to open: " + mprViewerUrl);
78 window.open(mprViewerUrl);
79 });
80 }
81 });
82 }
83 });
84 }
85 });
86 });
87