Mercurial > hg > orthanc
annotate OrthancExplorer/explorer.js @ 1424:fe384a9d3b51
OrthancPluginGetConfiguration
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Jun 2015 15:32:45 +0200 |
parents | c90a4a42a3f2 |
children | b8dc2f855a83 |
rev | line source |
---|---|
0 | 1 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin |
2 | |
3 | |
4 // Forbid the access to IE | |
5 if ($.browser.msie) | |
6 { | |
7 alert("Please use Mozilla Firefox or Google Chrome. Microsoft Internet Explorer is not supported."); | |
8 } | |
9 | |
10 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html | |
11 //$.mobile.ajaxEnabled = false; | |
12 //$.mobile.page.prototype.options.addBackBtn = true; | |
13 //$.mobile.defaultPageTransition = 'slide'; | |
14 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
15 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
16 var currentPage = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
17 var currentUuid = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
18 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
19 |
0 | 20 // http://stackoverflow.com/a/4673436 |
21 String.prototype.format = function() { | |
22 var args = arguments; | |
23 return this.replace(/{(\d+)}/g, function(match, number) { | |
24 /*return typeof args[number] != 'undefined' | |
25 ? args[number] | |
26 : match;*/ | |
27 | |
28 return args[number]; | |
29 }); | |
30 }; | |
31 | |
32 | |
33 $(document).ready(function() { | |
34 var $tree = $('#dicom-tree'); | |
35 $tree.tree({ | |
36 autoEscape: false | |
37 }); | |
38 | |
39 $('#dicom-tree').bind( | |
40 'tree.click', | |
41 function(event) { | |
42 if (event.node.is_open) | |
43 $tree.tree('closeNode', event.node, true); | |
44 else | |
45 $tree.tree('openNode', event.node, true); | |
46 } | |
47 ); | |
48 }); | |
49 | |
50 | |
51 function SplitLongUid(s) | |
52 { | |
53 return '<span>' + s.substr(0, s.length / 2) + '</span> <span>' + s.substr(s.length / 2, s.length - s.length / 2) + '</span>'; | |
54 } | |
55 | |
56 | |
57 function ParseDicomDate(s) | |
58 { | |
59 y = parseInt(s.substr(0, 4), 10); | |
60 m = parseInt(s.substr(4, 2), 10) - 1; | |
61 d = parseInt(s.substr(6, 2), 10); | |
62 | |
63 if (y == null || m == null || d == null || | |
64 !isFinite(y) || !isFinite(m) || !isFinite(d)) | |
65 { | |
66 return null; | |
67 } | |
68 | |
69 if (y < 1900 || y > 2100 || | |
70 m < 0 || m >= 12 || | |
71 d <= 0 || d >= 32) | |
72 { | |
73 return null; | |
74 } | |
75 | |
76 return new Date(y, m, d); | |
77 } | |
78 | |
79 | |
80 function FormatDicomDate(s) | |
81 { | |
82 if (s == undefined) | |
83 return "No date"; | |
84 | |
85 var d = ParseDicomDate(s); | |
86 if (d == null) | |
87 return '?'; | |
88 else | |
89 return d.toString('dddd, MMMM d, yyyy'); | |
90 } | |
91 | |
92 | |
80 | 93 function Sort(arr, fieldExtractor, isInteger, reverse) |
0 | 94 { |
33 | 95 var defaultValue; |
96 if (isInteger) | |
97 defaultValue = 0; | |
98 else | |
99 defaultValue = ''; | |
100 | |
0 | 101 arr.sort(function(a, b) { |
80 | 102 var ta = fieldExtractor(a); |
103 var tb = fieldExtractor(b); | |
0 | 104 var order; |
105 | |
33 | 106 if (ta == undefined) |
107 ta = defaultValue; | |
108 | |
109 if (tb == undefined) | |
110 tb = defaultValue; | |
111 | |
0 | 112 if (isInteger) |
113 { | |
114 ta = parseInt(ta, 10); | |
115 tb = parseInt(tb, 10); | |
116 order = ta - tb; | |
117 } | |
118 else | |
119 { | |
120 if (ta < tb) | |
121 order = -1; | |
122 else if (ta > tb) | |
123 order = 1; | |
124 else | |
125 order = 0; | |
126 } | |
127 | |
128 if (reverse) | |
129 return -order; | |
130 else | |
131 return order; | |
132 }); | |
133 } | |
134 | |
135 | |
80 | 136 function SortOnDicomTag(arr, tag, isInteger, reverse) |
137 { | |
138 return Sort(arr, function(a) { | |
139 return a.MainDicomTags[tag]; | |
140 }, isInteger, reverse); | |
141 } | |
142 | |
143 | |
0 | 144 |
1345 | 145 function GetResource(uri, callback) |
0 | 146 { |
147 $.ajax({ | |
1345 | 148 url: '..' + uri, |
0 | 149 dataType: 'json', |
150 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
151 cache: false, |
0 | 152 success: function(s) { |
153 callback(s); | |
154 } | |
155 }); | |
156 } | |
157 | |
158 | |
159 function CompleteFormatting(s, link, isReverse) | |
160 { | |
161 if (link != null) | |
162 { | |
163 s = 'href="' + link + '">' + s + '</a>'; | |
164 | |
165 if (isReverse) | |
166 s = 'data-direction="reverse" '+ s; | |
167 | |
168 s = '<a ' + s; | |
169 } | |
170 | |
171 if (isReverse) | |
172 return '<li data-icon="back">' + s + '</li>'; | |
173 else | |
174 return '<li>' + s + '</li>'; | |
175 } | |
176 | |
177 | |
38 | 178 function FormatMainDicomTags(tags, tagsToIgnore) |
179 { | |
180 var s = ''; | |
181 | |
182 for (var i in tags) | |
183 { | |
184 if (tagsToIgnore.indexOf(i) == -1) | |
185 { | |
186 var v = tags[i]; | |
187 | |
40 | 188 if (i == "PatientBirthDate" || |
189 i == "StudyDate" || | |
190 i == "SeriesDate") | |
38 | 191 { |
192 v = FormatDicomDate(v); | |
193 } | |
40 | 194 else if (i == "DicomStudyInstanceUID" || |
195 i == "DicomSeriesInstanceUID") | |
38 | 196 { |
197 v = SplitLongUid(v); | |
198 } | |
199 | |
200 | |
201 s += ('<p>{0}: <strong>{1}</strong></p>').format(i, v); | |
202 } | |
203 } | |
204 | |
205 return s; | |
206 } | |
207 | |
0 | 208 |
209 function FormatPatient(patient, link, isReverse) | |
210 { | |
40 | 211 var s = ('<h3>{0}</h3>{1}' + |
212 '<span class="ui-li-count">{2}</span>' | |
0 | 213 ).format |
38 | 214 (patient.MainDicomTags.PatientName, |
40 | 215 FormatMainDicomTags(patient.MainDicomTags, [ |
216 "PatientName", | |
217 "OtherPatientIDs" | |
218 ]), | |
0 | 219 patient.Studies.length |
220 ); | |
221 | |
222 return CompleteFormatting(s, link, isReverse); | |
223 } | |
224 | |
225 | |
226 | |
227 function FormatStudy(study, link, isReverse) | |
228 { | |
40 | 229 var s = ('<h3>{0}</h3>{1}' + |
0 | 230 '<span class="ui-li-count">{2}</span>' |
231 ).format | |
232 (study.MainDicomTags.StudyDescription, | |
40 | 233 FormatMainDicomTags(study.MainDicomTags, [ |
234 "StudyDescription", | |
235 "StudyTime" | |
236 ]), | |
0 | 237 study.Series.length |
238 ); | |
239 | |
240 return CompleteFormatting(s, link, isReverse); | |
241 } | |
242 | |
243 | |
244 | |
245 function FormatSeries(series, link, isReverse) | |
246 { | |
80 | 247 var c; |
82 | 248 if (series.ExpectedNumberOfInstances == null || |
249 series.Instances.length == series.ExpectedNumberOfInstances) | |
80 | 250 { |
82 | 251 c = series.Instances.length; |
80 | 252 } |
253 else | |
254 { | |
255 c = series.Instances.length + '/' + series.ExpectedNumberOfInstances; | |
256 } | |
257 | |
258 var s = ('<h3>{0}</h3>' + | |
259 '<p><em>Status: <strong>{1}</strong></em></p>{2}' + | |
260 '<span class="ui-li-count">{3}</span>').format | |
0 | 261 (series.MainDicomTags.SeriesDescription, |
80 | 262 series.Status, |
40 | 263 FormatMainDicomTags(series.MainDicomTags, [ |
264 "SeriesDescription", | |
265 "SeriesTime", | |
41
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
266 "Manufacturer", |
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
267 "ImagesInAcquisition", |
40 | 268 "SeriesDate" |
269 ]), | |
80 | 270 c |
0 | 271 ); |
272 | |
273 return CompleteFormatting(s, link, isReverse); | |
274 } | |
275 | |
276 | |
277 function FormatInstance(instance, link, isReverse) | |
278 { | |
40 | 279 var s = ('<h3>Instance {0}</h3>{1}').format |
80 | 280 (instance.IndexInSeries, |
40 | 281 FormatMainDicomTags(instance.MainDicomTags, [ |
282 "AcquisitionNumber", | |
283 "InstanceNumber", | |
284 "InstanceCreationDate", | |
285 "InstanceCreationTime" | |
286 ]) | |
0 | 287 ); |
288 | |
289 return CompleteFormatting(s, link, isReverse); | |
290 } | |
291 | |
292 | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
293 $('[data-role="page"]').live('pagebeforeshow', function() { |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
294 $.ajax({ |
153 | 295 url: '../system', |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
296 dataType: 'json', |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
297 async: false, |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
298 cache: false, |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
299 success: function(s) { |
165 | 300 if (s.Name != "") { |
301 $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> » '); | |
302 } | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
303 } |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
304 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
305 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
306 |
0 | 307 |
308 | |
309 $('#find-patients').live('pagebeforeshow', function() { | |
1345 | 310 GetResource('/patients?expand', function(patients) { |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
311 var target = $('#all-patients'); |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
312 $('li', target).remove(); |
0 | 313 |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
314 SortOnDicomTag(patients, 'PatientName', false, false); |
0 | 315 |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
316 for (var i = 0; i < patients.length; i++) { |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
317 var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID); |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
318 target.append(p); |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
319 } |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
320 |
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
321 target.listview('refresh'); |
1345 | 322 }); |
0 | 323 }); |
324 | |
325 | |
326 | |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
327 function SetupAnonymizedOrModifiedFrom(buttonSelector, resource, resourceType, field) |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
328 { |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
329 if (field in resource) |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
330 { |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
331 $(buttonSelector).closest('li').show(); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
332 $(buttonSelector).click(function(e) { |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
333 window.location.assign('explorer.html#' + resourceType + '?uuid=' + resource[field]); |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
334 }); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
335 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
336 else |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
337 { |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
338 $(buttonSelector).closest('li').hide(); |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
339 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
340 } |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
341 |
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
342 |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
343 |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
344 function RefreshPatient() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
345 { |
0 | 346 if ($.mobile.pageData) { |
1345 | 347 GetResource('/patients/' + $.mobile.pageData.uuid, function(patient) { |
348 GetResource('/patients/' + $.mobile.pageData.uuid + '/studies', function(studies) { | |
349 SortOnDicomTag(studies, 'StudyDate', false, true); | |
0 | 350 |
1345 | 351 $('#patient-info li').remove(); |
352 $('#patient-info') | |
353 .append('<li data-role="list-divider">Patient</li>') | |
354 .append(FormatPatient(patient)) | |
355 .listview('refresh'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
356 |
1345 | 357 var target = $('#list-studies'); |
358 $('li', target).remove(); | |
359 | |
360 for (var i = 0; i < studies.length; i++) { | |
361 if (i == 0 || studies[i].MainDicomTags.StudyDate != studies[i - 1].MainDicomTags.StudyDate) | |
362 { | |
363 target.append('<li data-role="list-divider">{0}</li>'.format | |
364 (FormatDicomDate(studies[i].MainDicomTags.StudyDate))); | |
0 | 365 } |
366 | |
1345 | 367 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); |
368 } | |
0 | 369 |
1345 | 370 SetupAnonymizedOrModifiedFrom('#patient-anonymized-from', patient, 'patient', 'AnonymizedFrom'); |
371 SetupAnonymizedOrModifiedFrom('#patient-modified-from', patient, 'patient', 'ModifiedFrom'); | |
372 | |
373 target.listview('refresh'); | |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
374 |
1345 | 375 // Check whether this patient is protected |
376 $.ajax({ | |
377 url: '../patients/' + $.mobile.pageData.uuid + '/protected', | |
378 type: 'GET', | |
379 dataType: 'text', | |
380 async: false, | |
381 cache: false, | |
382 success: function (s) { | |
383 var v = (s == '1') ? 'on' : 'off'; | |
384 $('#protection').val(v).slider('refresh'); | |
385 } | |
386 }); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
387 |
1345 | 388 currentPage = 'patient'; |
389 currentUuid = $.mobile.pageData.uuid; | |
0 | 390 }); |
391 }); | |
392 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
393 } |
0 | 394 |
395 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
396 function RefreshStudy() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
397 { |
0 | 398 if ($.mobile.pageData) { |
1345 | 399 GetResource('/studies/' + $.mobile.pageData.uuid, function(study) { |
400 GetResource('/patients/' + study.ParentPatient, function(patient) { | |
401 GetResource('/studies/' + $.mobile.pageData.uuid + '/series', function(series) { | |
402 SortOnDicomTag(series, 'SeriesDate', false, true); | |
0 | 403 |
1345 | 404 $('#study .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
405 $('#study-info li').remove(); | |
406 $('#study-info') | |
407 .append('<li data-role="list-divider">Patient</li>') | |
408 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
409 .append('<li data-role="list-divider">Study</li>') | |
410 .append(FormatStudy(study)) | |
411 .listview('refresh'); | |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
412 |
1345 | 413 SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', 'AnonymizedFrom'); |
414 SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', 'ModifiedFrom'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
415 |
1345 | 416 var target = $('#list-series'); |
417 $('li', target).remove(); | |
418 for (var i = 0; i < series.length; i++) { | |
419 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate) | |
420 { | |
421 target.append('<li data-role="list-divider">{0}</li>'.format | |
422 (FormatDicomDate(series[i].MainDicomTags.SeriesDate))); | |
0 | 423 } |
1345 | 424 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID)); |
425 } | |
426 target.listview('refresh'); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
427 |
1345 | 428 currentPage = 'study'; |
429 currentUuid = $.mobile.pageData.uuid; | |
0 | 430 }); |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
431 }); |
0 | 432 }); |
433 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
434 } |
0 | 435 |
436 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
437 function RefreshSeries() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
438 { |
0 | 439 if ($.mobile.pageData) { |
1345 | 440 GetResource('/series/' + $.mobile.pageData.uuid, function(series) { |
441 GetResource('/studies/' + series.ParentStudy, function(study) { | |
442 GetResource('/patients/' + study.ParentPatient, function(patient) { | |
443 GetResource('/series/' + $.mobile.pageData.uuid + '/instances', function(instances) { | |
444 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); | |
0 | 445 |
1345 | 446 $('#series .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
447 $('#series .study-link').attr('href', '#study?uuid=' + study.ID); | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
448 |
1345 | 449 $('#series-info li').remove(); |
450 $('#series-info') | |
451 .append('<li data-role="list-divider">Patient</li>') | |
452 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
453 .append('<li data-role="list-divider">Study</li>') | |
454 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) | |
455 .append('<li data-role="list-divider">Series</li>') | |
456 .append(FormatSeries(series)) | |
457 .listview('refresh'); | |
0 | 458 |
1345 | 459 SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', 'AnonymizedFrom'); |
460 SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', 'ModifiedFrom'); | |
443
be93b666ed79
link anonymized to original resource in OrthancExplorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
405
diff
changeset
|
461 |
1345 | 462 var target = $('#list-instances'); |
463 $('li', target).remove(); | |
464 for (var i = 0; i < instances.length; i++) { | |
465 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); | |
466 } | |
467 target.listview('refresh'); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
468 |
1345 | 469 currentPage = 'series'; |
470 currentUuid = $.mobile.pageData.uuid; | |
0 | 471 }); |
472 }); | |
473 }); | |
474 }); | |
475 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
476 } |
0 | 477 |
478 | |
479 | |
480 function ConvertForTree(dicom) | |
481 { | |
482 var result = []; | |
483 | |
484 for (var i in dicom) { | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
485 if (dicom[i] != null) { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
486 var label = i + '<span class="tag-name"> (<i>' + dicom[i]["Name"] + '</i>)</span>: '; |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
487 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
488 if (dicom[i]["Type"] == 'String') |
0 | 489 { |
490 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
491 label: label + '<strong>' + dicom[i]["Value"] + '</strong>', |
0 | 492 children: [] |
493 }); | |
494 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
495 else if (dicom[i]["Type"] == 'TooLong') |
0 | 496 { |
497 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
498 label: label + '<i>Too long</i>', |
0 | 499 children: [] |
500 }); | |
501 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
502 else if (dicom[i]["Type"] == 'Null') |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
503 { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
504 result.push({ |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
505 label: label + '<i>Null</i>', |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
506 children: [] |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
507 }); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
508 } |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
509 else if (dicom[i]["Type"] == 'Sequence') |
0 | 510 { |
511 var c = []; | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
512 for (var j = 0; j < dicom[i]["Value"].length; j++) { |
0 | 513 c.push({ |
514 label: 'Item ' + j, | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
515 children: ConvertForTree(dicom[i]["Value"][j]) |
0 | 516 }); |
517 } | |
518 | |
519 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
520 label: label + '[]', |
0 | 521 children: c |
522 }); | |
523 } | |
524 } | |
525 } | |
526 | |
527 return result; | |
528 } | |
529 | |
530 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
531 function RefreshInstance() |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
532 { |
0 | 533 if ($.mobile.pageData) { |
1345 | 534 GetResource('/instances/' + $.mobile.pageData.uuid, function(instance) { |
535 GetResource('/series/' + instance.ParentSeries, function(series) { | |
536 GetResource('/studies/' + series.ParentStudy, function(study) { | |
537 GetResource('/patients/' + study.ParentPatient, function(patient) { | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
538 |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
539 $('#instance .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
540 $('#instance .study-link').attr('href', '#study?uuid=' + study.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
541 $('#instance .series-link').attr('href', '#series?uuid=' + series.ID); |
0 | 542 |
543 $('#instance-info li').remove(); | |
544 $('#instance-info') | |
545 .append('<li data-role="list-divider">Patient</li>') | |
546 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
547 .append('<li data-role="list-divider">Study</li>') | |
548 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) | |
549 .append('<li data-role="list-divider">Series</li>') | |
550 .append(FormatSeries(series, '#series?uuid=' + series.ID, true)) | |
551 .append('<li data-role="list-divider">Instance</li>') | |
552 .append(FormatInstance(instance)) | |
553 .listview('refresh'); | |
554 | |
1345 | 555 GetResource('/instances/' + instance.ID + '/tags', function(s) { |
556 $('#dicom-tree').tree('loadData', ConvertForTree(s)); | |
0 | 557 }); |
558 | |
515
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
559 SetupAnonymizedOrModifiedFrom('#instance-anonymized-from', instance, 'instance', 'AnonymizedFrom'); |
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
560 SetupAnonymizedOrModifiedFrom('#instance-modified-from', instance, 'instance', 'ModifiedFrom'); |
a8be42bcf2bb
Link from modified to original resource in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
485
diff
changeset
|
561 |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
562 currentPage = 'instance'; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
563 currentUuid = $.mobile.pageData.uuid; |
0 | 564 }); |
565 }); | |
566 }); | |
567 }); | |
568 } | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
569 } |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
570 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
571 $(document).live('pagebeforehide', function() { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
572 currentPage = ''; |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
573 currentUuid = ''; |
0 | 574 }); |
575 | |
576 | |
577 | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
578 $('#patient').live('pagebeforeshow', RefreshPatient); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
579 $('#study').live('pagebeforeshow', RefreshStudy); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
580 $('#series').live('pagebeforeshow', RefreshSeries); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
581 $('#instance').live('pagebeforeshow', RefreshInstance); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
582 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
583 $(function() { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
584 $(window).hashchange(function(e, data) { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
585 // This fixes the navigation with the back button and with the anonymization |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
586 if ('uuid' in $.mobile.pageData && |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
587 currentPage == $.mobile.pageData.active && |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
588 currentUuid != $.mobile.pageData.uuid) { |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
589 if (currentPage == 'patient') |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
590 RefreshPatient(); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
591 else if (currentPage == 'study') |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
592 RefreshStudy(); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
593 else if (currentPage == 'series') |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
594 RefreshSeries(); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
595 else if (currentPage == 'instance') |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
596 RefreshInstance(); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
597 } |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
598 }); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
599 }); |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
600 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
601 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
602 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
603 |
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
604 |
0 | 605 function DeleteResource(path) |
606 { | |
607 $.ajax({ | |
608 url: path, | |
609 type: 'DELETE', | |
610 dataType: 'json', | |
611 async: false, | |
612 success: function(s) { | |
613 var ancestor = s.RemainingAncestor; | |
614 if (ancestor == null) | |
615 $.mobile.changePage('#find-patients'); | |
616 else | |
201
bee20e978835
refactoring of delete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
165
diff
changeset
|
617 $.mobile.changePage('#' + ancestor.Type.toLowerCase() + '?uuid=' + ancestor.ID); |
0 | 618 } |
619 }); | |
620 } | |
621 | |
622 | |
623 | |
624 function OpenDeleteResourceDialog(path, title) | |
625 { | |
626 $(document).simpledialog2({ | |
627 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/ | |
628 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/options.html | |
629 mode: 'button', | |
630 animate: false, | |
631 headerText: title, | |
632 headerClose: true, | |
633 width: '500px', | |
634 buttons : { | |
635 'OK': { | |
636 click: function () { | |
637 DeleteResource(path); | |
638 }, | |
639 icon: "delete", | |
640 theme: "c" | |
641 }, | |
642 'Cancel': { | |
643 click: function () { | |
644 } | |
645 } | |
646 } | |
647 }); | |
648 } | |
649 | |
650 | |
651 | |
652 $('#instance-delete').live('click', function() { | |
83 | 653 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid, |
0 | 654 'Delete this instance?'); |
655 }); | |
656 | |
657 $('#study-delete').live('click', function() { | |
83 | 658 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid, |
0 | 659 'Delete this study?'); |
660 }); | |
661 | |
662 $('#series-delete').live('click', function() { | |
83 | 663 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid, |
0 | 664 'Delete this series?'); |
665 }); | |
666 | |
667 $('#patient-delete').live('click', function() { | |
83 | 668 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid, |
0 | 669 'Delete this patient?'); |
670 }); | |
671 | |
672 | |
673 $('#instance-download-dicom').live('click', function(e) { | |
674 // http://stackoverflow.com/a/1296101 | |
675 e.preventDefault(); //stop the browser from following | |
83 | 676 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file'; |
0 | 677 }); |
678 | |
679 $('#instance-download-json').live('click', function(e) { | |
680 // http://stackoverflow.com/a/1296101 | |
681 e.preventDefault(); //stop the browser from following | |
83 | 682 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags'; |
0 | 683 }); |
684 | |
685 | |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
686 |
0 | 687 $('#instance-preview').live('click', function(e) { |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
688 if ($.mobile.pageData) { |
1345 | 689 GetResource('/instances/' + $.mobile.pageData.uuid + '/frames', function(frames) { |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
690 if (frames.length == 1) |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
691 { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
692 // Viewing a single-frame image |
83 | 693 jQuery.slimbox('../instances/' + $.mobile.pageData.uuid + '/preview', '', { |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
694 overlayFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
695 resizeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
696 imageFadeDuration : 1 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
697 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
698 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
699 else |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
700 { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
701 // Viewing a multi-frame image |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
702 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
703 var images = []; |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
704 for (var i = 0; i < frames.length; i++) { |
83 | 705 images.push([ '../instances/' + $.mobile.pageData.uuid + '/frames/' + i + '/preview' ]); |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
706 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
707 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
708 jQuery.slimbox(images, 0, { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
709 overlayFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
710 resizeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
711 imageFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
712 loop : true |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
713 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
714 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
715 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
716 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
717 } |
0 | 718 }); |
719 | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
720 |
1345 | 721 |
0 | 722 $('#series-preview').live('click', function(e) { |
723 if ($.mobile.pageData) { | |
1345 | 724 GetResource('/series/' + $.mobile.pageData.uuid, function(series) { |
725 GetResource('/series/' + $.mobile.pageData.uuid + '/instances', function(instances) { | |
726 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); | |
0 | 727 |
1345 | 728 var images = []; |
729 for (var i = 0; i < instances.length; i++) { | |
730 images.push([ '../instances/' + instances[i].ID + '/preview', | |
731 '{0}/{1}'.format(i + 1, instances.length) ]) | |
732 } | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
733 |
1345 | 734 jQuery.slimbox(images, 0, { |
735 overlayFadeDuration : 1, | |
736 resizeDuration : 1, | |
737 imageFadeDuration : 1, | |
738 loop : true | |
739 }); | |
1343
72d1c2fc0edb
Huge speed-up in Orthanc Explorer for large amount of images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1232
diff
changeset
|
740 }); |
0 | 741 }); |
742 } | |
743 }); | |
744 | |
745 | |
746 | |
747 | |
748 | |
749 function ChooseDicomModality(callback) | |
750 { | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
751 var clickedModality = ''; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
752 var clickedPeer = ''; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
753 var items = $('<ul>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
754 .attr('data-divider-theme', 'd') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
755 .attr('data-role', 'listview'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
756 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
757 // Retrieve the list of the known DICOM modalities |
0 | 758 $.ajax({ |
83 | 759 url: '../modalities', |
0 | 760 type: 'GET', |
761 dataType: 'json', | |
762 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
763 cache: false, |
0 | 764 success: function(modalities) { |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
765 if (modalities.length > 0) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
766 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
767 items.append('<li data-role="list-divider">DICOM modalities</li>'); |
484
b8ace6fc1d1f
preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
482
diff
changeset
|
768 |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
769 for (var i = 0; i < modalities.length; i++) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
770 var name = modalities[i]; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
771 var item = $('<li>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
772 .html('<a href="#" rel="close">' + name + '</a>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
773 .attr('name', name) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
774 .click(function() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
775 clickedModality = $(this).attr('name'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
776 }); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
777 items.append(item); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
778 } |
0 | 779 } |
780 | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
781 // Retrieve the list of the known Orthanc peers |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
782 $.ajax({ |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
783 url: '../peers', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
784 type: 'GET', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
785 dataType: 'json', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
786 async: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
787 cache: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
788 success: function(peers) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
789 if (peers.length > 0) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
790 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
791 items.append('<li data-role="list-divider">Orthanc peers</li>'); |
484
b8ace6fc1d1f
preparation for handling Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
482
diff
changeset
|
792 |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
793 for (var i = 0; i < peers.length; i++) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
794 var name = peers[i]; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
795 var item = $('<li>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
796 .html('<a href="#" rel="close">' + name + '</a>') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
797 .attr('name', name) |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
798 .click(function() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
799 clickedPeer = $(this).attr('name'); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
800 }); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
801 items.append(item); |
0 | 802 } |
803 } | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
804 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
805 // Launch the dialog |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
806 $('#dialog').simpledialog2({ |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
807 mode: 'blank', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
808 animate: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
809 headerText: 'Choose target', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
810 headerClose: true, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
811 forceInput: false, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
812 width: '100%', |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
813 blankContent: items, |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
814 callbackClose: function() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
815 var timer; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
816 function WaitForDialogToClose() { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
817 if (!$('#dialog').is(':visible')) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
818 clearInterval(timer); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
819 callback(clickedModality, clickedPeer); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
820 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
821 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
822 timer = setInterval(WaitForDialogToClose, 100); |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
823 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
824 }); |
0 | 825 } |
826 }); | |
827 } | |
828 }); | |
829 } | |
830 | |
831 | |
405
97a00b30abcc
sending of studies and patients with orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
354
diff
changeset
|
832 $('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) { |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
833 ChooseDicomModality(function(modality, peer) { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
834 var url; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
835 var loading; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
836 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
837 if (modality != '') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
838 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
839 url = '../modalities/' + modality + '/store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
840 loading = '#dicom-store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
841 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
842 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
843 if (peer != '') |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
844 { |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
845 url = '../peers/' + peer + '/store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
846 loading = '#peer-store'; |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
847 } |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
848 |
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
849 if (url != '') { |
0 | 850 $.ajax({ |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
851 url: url, |
0 | 852 type: 'POST', |
853 dataType: 'text', | |
854 data: $.mobile.pageData.uuid, | |
855 async: true, // Necessary to block UI | |
856 beforeSend: function() { | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
857 $.blockUI({ message: $(loading) }); |
0 | 858 }, |
859 complete: function(s) { | |
860 $.unblockUI(); | |
861 }, | |
862 success: function(s) { | |
863 }, | |
864 error: function() { | |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
865 alert('Error during store'); |
0 | 866 } |
485
bdbde1fbfab3
send resources through HTTP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
484
diff
changeset
|
867 }); |
0 | 868 } |
869 }); | |
870 }); | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
871 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
872 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
873 $('#show-tag-name').live('change', function(e) { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
874 var checked = e.currentTarget.checked; |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
875 if (checked) |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
876 $('.tag-name').show(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
877 else |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
878 $('.tag-name').hide(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
879 }); |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
880 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
881 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
882 $('#patient-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
883 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
884 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
885 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
886 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
887 $('#study-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
888 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
889 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
890 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
891 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
892 $('#series-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
893 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
894 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
895 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
896 |
1188
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
897 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
898 $('#patient-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
899 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
900 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
901 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
902 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
903 $('#study-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
904 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
905 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
906 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
907 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
908 $('#series-media').live('click', function(e) { |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
909 e.preventDefault(); //stop the browser from following |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
910 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media'; |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
911 }); |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
912 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
913 |
2e11c3353356
download dicomdir in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
515
diff
changeset
|
914 |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
915 $('#protection').live('change', function(e) { |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
916 var isProtected = e.target.value == "on"; |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
917 $.ajax({ |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
918 url: '../patients/' + $.mobile.pageData.uuid + '/protected', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
919 type: 'PUT', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
920 dataType: 'text', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
921 data: isProtected ? '1' : '0', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
922 async: false |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
923 }); |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
924 }); |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
925 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
926 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
927 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
928 function OpenAnonymizeResourceDialog(path, title) |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
929 { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
930 $(document).simpledialog2({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
931 mode: 'button', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
932 animate: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
933 headerText: title, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
934 headerClose: true, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
935 width: '500px', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
936 buttons : { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
937 'OK': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
938 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
939 $.ajax({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
940 url: path + '/anonymize', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
941 type: 'POST', |
354 | 942 data: '{ "Keep" : [ "SeriesDescription", "StudyDescription" ] }', |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
943 dataType: 'json', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
944 async: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
945 cache: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
946 success: function(s) { |
351 | 947 // The following line does not work... |
948 //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID); | |
949 | |
950 window.location.assign('explorer.html#patient?uuid=' + s.PatientID); | |
482
b05eb8708aee
fix history in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
443
diff
changeset
|
951 //window.location.reload(); |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
952 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
953 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
954 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
955 icon: "delete", |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
956 theme: "c" |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
957 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
958 'Cancel': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
959 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
960 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
961 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
962 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
963 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
964 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
965 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
966 $('#instance-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
967 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
968 'Anonymize this instance?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
969 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
970 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
971 $('#study-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
972 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
973 'Anonymize this study?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
974 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
975 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
976 $('#series-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
977 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
978 'Anonymize this series?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
979 }); |
351 | 980 |
981 $('#patient-anonymize').live('click', function() { | |
982 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid, | |
983 'Anonymize this patient?'); | |
984 }); | |
1232
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
985 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
986 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
987 $('#plugins').live('pagebeforeshow', function() { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
988 $.ajax({ |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
989 url: '../plugins', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
990 dataType: 'json', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
991 async: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
992 cache: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
993 success: function(plugins) { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
994 var target = $('#all-plugins'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
995 $('li', target).remove(); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
996 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
997 plugins.map(function(id) { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
998 return $.ajax({ |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
999 url: '../plugins/' + id, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1000 dataType: 'json', |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1001 async: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1002 cache: false, |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1003 success: function(plugin) { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1004 var li = $('<li>'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1005 var item = li; |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1006 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1007 if ('RootUri' in plugin) |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1008 { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1009 item = $('<a>'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1010 li.append(item); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1011 item.click(function() { |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1012 window.open(plugin.RootUri); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1013 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1014 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1015 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1016 item.append($('<h1>').text(plugin.ID)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1017 item.append($('<p>').text(plugin.Description)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1018 item.append($('<span>').addClass('ui-li-count').text(plugin.Version)); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1019 target.append(li); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1020 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1021 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1022 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1023 |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1024 target.listview('refresh'); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1025 } |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1026 }); |
f1c01451a8ee
Introspection of plugins, Plugins can extend Orthanc Explorer with custom JavaScript
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1188
diff
changeset
|
1027 }); |