comparison StoneWebViewer/Plugin/OrthancExplorer.js @ 1519:22d1bd085c19

split STONE_BINARIES into two different vars for both StoneWebViewer and RtViewer + fixed docker build + embed of RtViewer files + serving of RtViewer files + Orthanc explorer extension to open a series in the RtViewer : sibling series will be traversed and the first DOSE/STRUCT will be used. WARNING: needs work for PT and to allow for missing dose
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 31 Jul 2020 12:51:28 +0200
parents fb74ed5d8c22
children 61023b0d39c8
comparison
equal deleted inserted replaced
1518:433cf964838d 1519:22d1bd085c19
53 } 53 }
54 }); 54 });
55 } 55 }
56 }); 56 });
57 }); 57 });
58
59 $('#series').live('pagebeforecreate', function() {
60 var b = $('<a>')
61 .attr('data-role', 'button')
62 .attr('href', '#')
63 .attr('data-icon', 'search')
64 .attr('data-theme', 'e')
65 .text('Stone MPR RT Viewer');``
66
67 b.insertBefore($('#series-delete').parent().parent());
68 b.click(function() {
69 if ($.mobile.pageData) {
70 $.ajax({
71 url: '../series/' + $.mobile.pageData.uuid,
72 dataType: 'json',
73 cache: false,
74 success: function(series) {
75
76 // we consider that the imaging series to display is the
77 // current one.
78 // we will look for RTDOSE and RTSTRUCT instances in the
79 // sibling series from the same study. The first one of
80 // each modality will be grabbed.
81 let ctSeries = $.mobile.pageData.uuid;
82
83 $.ajax({
84 url: '../studies/' + series.ParentStudy,
85 dataType: 'json',
86 cache: false,
87 success: function(study) {
88 // Loop on the study series and find the first RTSTRUCT and RTDOSE instances,
89 // if any.
90 let rtStructInstance = null;
91 let rtDoseInstance = null;
92 let rtPetInstance = null;
93 let seriesRequests = []
94
95 study.Series.forEach( function(studySeriesUuid) {
96 let request = $.ajax({
97 url: '../series/' + studySeriesUuid,
98 dataType: 'json',
99 cache: false,
100 });
101 seriesRequests.push(request);
102 });
103
104 $.when.apply($,seriesRequests).then(function() {
105 [].forEach.call(arguments, function(response) {
106 siblingSeries = response[0]
107 if (siblingSeries.MainDicomTags.Modality == "RTDOSE") {
108 // we have found an RTDOSE series. Let's grab the first instance
109 if (siblingSeries.Instances.length > 0) {
110 if(rtDoseInstance == null) {
111 rtDoseInstance = siblingSeries.Instances[0];
112 }
113 }
114 }
115 if (siblingSeries.MainDicomTags.Modality == "PT") {
116 // we have found an RTDOSE series. Let's grab the first instance
117 if (siblingSeries.Instances.length > 0) {
118 if(rtPetInstance == null) {
119 rtPetInstance = siblingSeries.Instances[0];
120 }
121 }
122 }
123 if (siblingSeries.MainDicomTags.Modality == "RTSTRUCT") {
124 // we have found an RTDOSE series. Let's grab the first instance
125 if (siblingSeries.Instances.length > 0) {
126 if(rtStructInstance == null) {
127 rtStructInstance = siblingSeries.Instances[0];
128 }
129 }
130 }
131 });
132 let mprViewerUrl = '../stone-rtviewer/index.html?ctseries=' + ctSeries +
133 '&rtdose=' + rtDoseInstance +
134 '&rtstruct=' + rtStructInstance;
135 //console.log("About to open: " + mprViewerUrl);
136 window.open(mprViewerUrl);
137 });
138 }
139 });
140 }
141 });
142 }
143 });
144 });
145