Mercurial > hg > orthanc
annotate OrthancExplorer/explorer.js @ 373:7000726bade7
fix ImportDicomFiles
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 25 Mar 2013 12:12:37 +0100 |
parents | 4d76fce206ef |
children | 97a00b30abcc |
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 | |
15 // http://stackoverflow.com/a/4673436 | |
16 String.prototype.format = function() { | |
17 var args = arguments; | |
18 return this.replace(/{(\d+)}/g, function(match, number) { | |
19 /*return typeof args[number] != 'undefined' | |
20 ? args[number] | |
21 : match;*/ | |
22 | |
23 return args[number]; | |
24 }); | |
25 }; | |
26 | |
27 | |
28 $(document).ready(function() { | |
29 var $tree = $('#dicom-tree'); | |
30 $tree.tree({ | |
31 autoEscape: false | |
32 }); | |
33 | |
34 $('#dicom-tree').bind( | |
35 'tree.click', | |
36 function(event) { | |
37 if (event.node.is_open) | |
38 $tree.tree('closeNode', event.node, true); | |
39 else | |
40 $tree.tree('openNode', event.node, true); | |
41 } | |
42 ); | |
43 }); | |
44 | |
45 | |
46 function SplitLongUid(s) | |
47 { | |
48 return '<span>' + s.substr(0, s.length / 2) + '</span> <span>' + s.substr(s.length / 2, s.length - s.length / 2) + '</span>'; | |
49 } | |
50 | |
51 | |
52 function ParseDicomDate(s) | |
53 { | |
54 y = parseInt(s.substr(0, 4), 10); | |
55 m = parseInt(s.substr(4, 2), 10) - 1; | |
56 d = parseInt(s.substr(6, 2), 10); | |
57 | |
58 if (y == null || m == null || d == null || | |
59 !isFinite(y) || !isFinite(m) || !isFinite(d)) | |
60 { | |
61 return null; | |
62 } | |
63 | |
64 if (y < 1900 || y > 2100 || | |
65 m < 0 || m >= 12 || | |
66 d <= 0 || d >= 32) | |
67 { | |
68 return null; | |
69 } | |
70 | |
71 return new Date(y, m, d); | |
72 } | |
73 | |
74 | |
75 function FormatDicomDate(s) | |
76 { | |
77 if (s == undefined) | |
78 return "No date"; | |
79 | |
80 var d = ParseDicomDate(s); | |
81 if (d == null) | |
82 return '?'; | |
83 else | |
84 return d.toString('dddd, MMMM d, yyyy'); | |
85 } | |
86 | |
87 | |
80 | 88 function Sort(arr, fieldExtractor, isInteger, reverse) |
0 | 89 { |
33 | 90 var defaultValue; |
91 if (isInteger) | |
92 defaultValue = 0; | |
93 else | |
94 defaultValue = ''; | |
95 | |
0 | 96 arr.sort(function(a, b) { |
80 | 97 var ta = fieldExtractor(a); |
98 var tb = fieldExtractor(b); | |
0 | 99 var order; |
100 | |
33 | 101 if (ta == undefined) |
102 ta = defaultValue; | |
103 | |
104 if (tb == undefined) | |
105 tb = defaultValue; | |
106 | |
0 | 107 if (isInteger) |
108 { | |
109 ta = parseInt(ta, 10); | |
110 tb = parseInt(tb, 10); | |
111 order = ta - tb; | |
112 } | |
113 else | |
114 { | |
115 if (ta < tb) | |
116 order = -1; | |
117 else if (ta > tb) | |
118 order = 1; | |
119 else | |
120 order = 0; | |
121 } | |
122 | |
123 if (reverse) | |
124 return -order; | |
125 else | |
126 return order; | |
127 }); | |
128 } | |
129 | |
130 | |
80 | 131 function SortOnDicomTag(arr, tag, isInteger, reverse) |
132 { | |
133 return Sort(arr, function(a) { | |
134 return a.MainDicomTags[tag]; | |
135 }, isInteger, reverse); | |
136 } | |
137 | |
138 | |
0 | 139 |
140 function GetSingleResource(type, uuid, callback) | |
141 { | |
142 var resource = null; | |
143 $.ajax({ | |
83 | 144 url: '../' + type + '/' + uuid, |
0 | 145 dataType: 'json', |
146 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
147 cache: false, |
0 | 148 success: function(s) { |
149 callback(s); | |
150 } | |
151 }); | |
152 } | |
153 | |
154 | |
155 function GetMultipleResources(type, uuids, callback) | |
156 { | |
157 if (uuids == null) | |
158 { | |
159 $.ajax({ | |
83 | 160 url: '../' + type, |
0 | 161 dataType: 'json', |
162 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
163 cache: false, |
0 | 164 success: function(s) { |
165 uuids = s; | |
166 } | |
167 }); | |
168 } | |
169 | |
170 var resources = []; | |
171 var ajaxRequests = uuids.map(function(uuid) { | |
172 return $.ajax({ | |
83 | 173 url: '../' + type + '/' + uuid, |
0 | 174 dataType: 'json', |
175 async: true, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
176 cache: false, |
0 | 177 success: function(s) { |
178 resources.push(s); | |
179 } | |
180 }); | |
181 }); | |
182 | |
183 // Wait for all the AJAX requests to end | |
184 $.when.apply($, ajaxRequests).then(function() { | |
185 callback(resources); | |
186 }); | |
187 } | |
188 | |
189 | |
190 | |
191 function CompleteFormatting(s, link, isReverse) | |
192 { | |
193 if (link != null) | |
194 { | |
195 s = 'href="' + link + '">' + s + '</a>'; | |
196 | |
197 if (isReverse) | |
198 s = 'data-direction="reverse" '+ s; | |
199 | |
200 s = '<a ' + s; | |
201 } | |
202 | |
203 if (isReverse) | |
204 return '<li data-icon="back">' + s + '</li>'; | |
205 else | |
206 return '<li>' + s + '</li>'; | |
207 } | |
208 | |
209 | |
38 | 210 function FormatMainDicomTags(tags, tagsToIgnore) |
211 { | |
212 var s = ''; | |
213 | |
214 for (var i in tags) | |
215 { | |
216 if (tagsToIgnore.indexOf(i) == -1) | |
217 { | |
218 var v = tags[i]; | |
219 | |
40 | 220 if (i == "PatientBirthDate" || |
221 i == "StudyDate" || | |
222 i == "SeriesDate") | |
38 | 223 { |
224 v = FormatDicomDate(v); | |
225 } | |
40 | 226 else if (i == "DicomStudyInstanceUID" || |
227 i == "DicomSeriesInstanceUID") | |
38 | 228 { |
229 v = SplitLongUid(v); | |
230 } | |
231 | |
232 | |
233 s += ('<p>{0}: <strong>{1}</strong></p>').format(i, v); | |
234 } | |
235 } | |
236 | |
237 return s; | |
238 } | |
239 | |
0 | 240 |
241 function FormatPatient(patient, link, isReverse) | |
242 { | |
40 | 243 var s = ('<h3>{0}</h3>{1}' + |
244 '<span class="ui-li-count">{2}</span>' | |
0 | 245 ).format |
38 | 246 (patient.MainDicomTags.PatientName, |
40 | 247 FormatMainDicomTags(patient.MainDicomTags, [ |
248 "PatientName", | |
249 "OtherPatientIDs" | |
250 ]), | |
0 | 251 patient.Studies.length |
252 ); | |
253 | |
254 return CompleteFormatting(s, link, isReverse); | |
255 } | |
256 | |
257 | |
258 | |
259 function FormatStudy(study, link, isReverse) | |
260 { | |
40 | 261 var s = ('<h3>{0}</h3>{1}' + |
0 | 262 '<span class="ui-li-count">{2}</span>' |
263 ).format | |
264 (study.MainDicomTags.StudyDescription, | |
40 | 265 FormatMainDicomTags(study.MainDicomTags, [ |
266 "StudyDescription", | |
267 "StudyTime" | |
268 ]), | |
0 | 269 study.Series.length |
270 ); | |
271 | |
272 return CompleteFormatting(s, link, isReverse); | |
273 } | |
274 | |
275 | |
276 | |
277 function FormatSeries(series, link, isReverse) | |
278 { | |
80 | 279 var c; |
82 | 280 if (series.ExpectedNumberOfInstances == null || |
281 series.Instances.length == series.ExpectedNumberOfInstances) | |
80 | 282 { |
82 | 283 c = series.Instances.length; |
80 | 284 } |
285 else | |
286 { | |
287 c = series.Instances.length + '/' + series.ExpectedNumberOfInstances; | |
288 } | |
289 | |
290 var s = ('<h3>{0}</h3>' + | |
291 '<p><em>Status: <strong>{1}</strong></em></p>{2}' + | |
292 '<span class="ui-li-count">{3}</span>').format | |
0 | 293 (series.MainDicomTags.SeriesDescription, |
80 | 294 series.Status, |
40 | 295 FormatMainDicomTags(series.MainDicomTags, [ |
296 "SeriesDescription", | |
297 "SeriesTime", | |
41
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
298 "Manufacturer", |
c1097a676eca
better naming for preview images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
299 "ImagesInAcquisition", |
40 | 300 "SeriesDate" |
301 ]), | |
80 | 302 c |
0 | 303 ); |
304 | |
305 return CompleteFormatting(s, link, isReverse); | |
306 } | |
307 | |
308 | |
309 function FormatInstance(instance, link, isReverse) | |
310 { | |
40 | 311 var s = ('<h3>Instance {0}</h3>{1}').format |
80 | 312 (instance.IndexInSeries, |
40 | 313 FormatMainDicomTags(instance.MainDicomTags, [ |
314 "AcquisitionNumber", | |
315 "InstanceNumber", | |
316 "InstanceCreationDate", | |
317 "InstanceCreationTime" | |
318 ]) | |
0 | 319 ); |
320 | |
321 return CompleteFormatting(s, link, isReverse); | |
322 } | |
323 | |
324 | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
325 $('[data-role="page"]').live('pagebeforeshow', function() { |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
326 $.ajax({ |
153 | 327 url: '../system', |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
328 dataType: 'json', |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
329 async: false, |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
330 cache: false, |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
331 success: function(s) { |
165 | 332 if (s.Name != "") { |
333 $('.orthanc-name').html('<a class="ui-link" href="explorer.html">' + s.Name + '</a> » '); | |
334 } | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
335 } |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
336 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
337 }); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
338 |
0 | 339 |
340 | |
341 $('#find-patients').live('pagebeforeshow', function() { | |
342 GetMultipleResources('patients', null, function(patients) { | |
343 var target = $('#all-patients'); | |
344 $('li', target).remove(); | |
345 | |
346 SortOnDicomTag(patients, 'PatientName', false, false); | |
347 | |
348 for (var i = 0; i < patients.length; i++) { | |
349 var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID); | |
350 target.append(p); | |
351 } | |
352 | |
353 target.listview('refresh'); | |
354 }); | |
355 }); | |
356 | |
357 | |
358 | |
359 $('#patient').live('pagebeforeshow', function() { | |
360 if ($.mobile.pageData) { | |
361 GetSingleResource('patients', $.mobile.pageData.uuid, function(patient) { | |
362 GetMultipleResources('studies', patient.Studies, function(studies) { | |
363 SortOnDicomTag(studies, 'StudyDate', false, true); | |
364 | |
365 $('#patient-info li').remove(); | |
366 $('#patient-info') | |
367 .append('<li data-role="list-divider">Patient</li>') | |
368 .append(FormatPatient(patient)) | |
369 .listview('refresh'); | |
370 | |
371 var target = $('#list-studies'); | |
372 $('li', target).remove(); | |
373 | |
374 for (var i = 0; i < studies.length; i++) { | |
375 if (i == 0 || studies[i].MainDicomTags.StudyDate != studies[i - 1].MainDicomTags.StudyDate) | |
376 { | |
377 target.append('<li data-role="list-divider">{0}</li>'.format | |
378 (FormatDicomDate(studies[i].MainDicomTags.StudyDate))); | |
379 } | |
380 | |
381 target.append(FormatStudy(studies[i], '#study?uuid=' + studies[i].ID)); | |
382 } | |
383 | |
384 target.listview('refresh'); | |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
385 |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
386 // Check whether this patient is protected |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
387 $.ajax({ |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
388 url: '../patients/' + $.mobile.pageData.uuid + '/protected', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
389 type: 'GET', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
390 dataType: 'text', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
391 async: false, |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
392 cache: false, |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
393 success: function (s) { |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
394 var v = (s == '1') ? 'on' : 'off'; |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
395 $('#protection').val(v).slider('refresh'); |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
396 } |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
397 }); |
0 | 398 }); |
399 }); | |
400 } | |
401 }); | |
402 | |
403 | |
404 $('#study').live('pagebeforeshow', function() { | |
405 if ($.mobile.pageData) { | |
406 GetSingleResource('studies', $.mobile.pageData.uuid, function(study) { | |
407 GetSingleResource('patients', study.ParentPatient, function(patient) { | |
408 GetMultipleResources('series', study.Series, function(series) { | |
409 SortOnDicomTag(series, 'SeriesDate', false, true); | |
410 | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
411 $('#study .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
0 | 412 $('#study-info li').remove(); |
413 $('#study-info') | |
414 .append('<li data-role="list-divider">Patient</li>') | |
415 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
416 .append('<li data-role="list-divider">Study</li>') | |
417 .append(FormatStudy(study)) | |
418 .listview('refresh'); | |
419 | |
420 var target = $('#list-series'); | |
421 $('li', target).remove(); | |
422 for (var i = 0; i < series.length; i++) { | |
423 if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate) | |
424 { | |
425 target.append('<li data-role="list-divider">{0}</li>'.format | |
426 (FormatDicomDate(series[i].MainDicomTags.SeriesDate))); | |
427 } | |
428 target.append(FormatSeries(series[i], '#series?uuid=' + series[i].ID)); | |
429 } | |
430 target.listview('refresh'); | |
431 }); | |
432 }); | |
433 }); | |
434 } | |
435 }); | |
436 | |
437 | |
438 $('#series').live('pagebeforeshow', function() { | |
439 if ($.mobile.pageData) { | |
440 GetSingleResource('series', $.mobile.pageData.uuid, function(series) { | |
441 GetSingleResource('studies', series.ParentStudy, function(study) { | |
442 GetSingleResource('patients', study.ParentPatient, function(patient) { | |
443 GetMultipleResources('instances', series.Instances, function(instances) { | |
80 | 444 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); |
0 | 445 |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
446 $('#series .patient-link').attr('href', '#patient?uuid=' + patient.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
447 $('#series .study-link').attr('href', '#study?uuid=' + study.ID); |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
448 |
0 | 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'); | |
458 | |
459 var target = $('#list-instances'); | |
460 $('li', target).remove(); | |
461 for (var i = 0; i < instances.length; i++) { | |
462 target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID)); | |
463 } | |
464 target.listview('refresh'); | |
465 }); | |
466 }); | |
467 }); | |
468 }); | |
469 } | |
470 }); | |
471 | |
472 | |
473 | |
474 function ConvertForTree(dicom) | |
475 { | |
476 var result = []; | |
477 | |
478 for (var i in dicom) { | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
479 if (dicom[i] != null) { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
480 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
|
481 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
482 if (dicom[i]["Type"] == 'String') |
0 | 483 { |
484 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
485 label: label + '<strong>' + dicom[i]["Value"] + '</strong>', |
0 | 486 children: [] |
487 }); | |
488 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
489 else if (dicom[i]["Type"] == 'TooLong') |
0 | 490 { |
491 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
492 label: label + '<i>Too long</i>', |
0 | 493 children: [] |
494 }); | |
495 } | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
496 else if (dicom[i]["Type"] == 'Null') |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
497 { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
498 result.push({ |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
499 label: label + '<i>Null</i>', |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
500 children: [] |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
501 }); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
502 } |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
503 else if (dicom[i]["Type"] == 'Sequence') |
0 | 504 { |
505 var c = []; | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
506 for (var j = 0; j < dicom[i]["Value"].length; j++) { |
0 | 507 c.push({ |
508 label: 'Item ' + j, | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
509 children: ConvertForTree(dicom[i]["Value"][j]) |
0 | 510 }); |
511 } | |
512 | |
513 result.push({ | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
514 label: label + '[]', |
0 | 515 children: c |
516 }); | |
517 } | |
518 } | |
519 } | |
520 | |
521 return result; | |
522 } | |
523 | |
524 | |
525 $('#instance').live('pagebeforeshow', function() { | |
526 if ($.mobile.pageData) { | |
527 GetSingleResource('instances', $.mobile.pageData.uuid, function(instance) { | |
528 GetSingleResource('series', instance.ParentSeries, function(series) { | |
529 GetSingleResource('studies', series.ParentStudy, function(study) { | |
530 GetSingleResource('patients', study.ParentPatient, function(patient) { | |
152
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
531 |
4829c054751a
improved navigation in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
151
diff
changeset
|
532 $('#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
|
533 $('#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
|
534 $('#instance .series-link').attr('href', '#series?uuid=' + series.ID); |
0 | 535 |
536 $('#instance-info li').remove(); | |
537 $('#instance-info') | |
538 .append('<li data-role="list-divider">Patient</li>') | |
539 .append(FormatPatient(patient, '#patient?uuid=' + patient.ID, true)) | |
540 .append('<li data-role="list-divider">Study</li>') | |
541 .append(FormatStudy(study, '#study?uuid=' + study.ID, true)) | |
542 .append('<li data-role="list-divider">Series</li>') | |
543 .append(FormatSeries(series, '#series?uuid=' + series.ID, true)) | |
544 .append('<li data-role="list-divider">Instance</li>') | |
545 .append(FormatInstance(instance)) | |
546 .listview('refresh'); | |
547 | |
548 $.ajax({ | |
83 | 549 url: '../instances/' + instance.ID + '/tags', |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
550 cache: false, |
0 | 551 dataType: 'json', |
552 success: function(s) { | |
553 $('#dicom-tree').tree('loadData', ConvertForTree(s)); | |
554 } | |
555 }); | |
556 | |
557 }); | |
558 }); | |
559 }); | |
560 }); | |
561 } | |
562 }); | |
563 | |
564 | |
565 | |
566 function DeleteResource(path) | |
567 { | |
568 $.ajax({ | |
569 url: path, | |
570 type: 'DELETE', | |
571 dataType: 'json', | |
572 async: false, | |
573 success: function(s) { | |
574 var ancestor = s.RemainingAncestor; | |
575 if (ancestor == null) | |
576 $.mobile.changePage('#find-patients'); | |
577 else | |
201
bee20e978835
refactoring of delete
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
165
diff
changeset
|
578 $.mobile.changePage('#' + ancestor.Type.toLowerCase() + '?uuid=' + ancestor.ID); |
0 | 579 } |
580 }); | |
581 } | |
582 | |
583 | |
584 | |
585 function OpenDeleteResourceDialog(path, title) | |
586 { | |
587 $(document).simpledialog2({ | |
588 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/ | |
589 // http://dev.jtsage.com/jQM-SimpleDialog/demos2/options.html | |
590 mode: 'button', | |
591 animate: false, | |
592 headerText: title, | |
593 headerClose: true, | |
594 width: '500px', | |
595 buttons : { | |
596 'OK': { | |
597 click: function () { | |
598 DeleteResource(path); | |
599 }, | |
600 icon: "delete", | |
601 theme: "c" | |
602 }, | |
603 'Cancel': { | |
604 click: function () { | |
605 } | |
606 } | |
607 } | |
608 }); | |
609 } | |
610 | |
611 | |
612 | |
613 $('#instance-delete').live('click', function() { | |
83 | 614 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid, |
0 | 615 'Delete this instance?'); |
616 }); | |
617 | |
618 $('#study-delete').live('click', function() { | |
83 | 619 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid, |
0 | 620 'Delete this study?'); |
621 }); | |
622 | |
623 $('#series-delete').live('click', function() { | |
83 | 624 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid, |
0 | 625 'Delete this series?'); |
626 }); | |
627 | |
628 $('#patient-delete').live('click', function() { | |
83 | 629 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid, |
0 | 630 'Delete this patient?'); |
631 }); | |
632 | |
633 | |
634 $('#instance-download-dicom').live('click', function(e) { | |
635 // http://stackoverflow.com/a/1296101 | |
636 e.preventDefault(); //stop the browser from following | |
83 | 637 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file'; |
0 | 638 }); |
639 | |
640 $('#instance-download-json').live('click', function(e) { | |
641 // http://stackoverflow.com/a/1296101 | |
642 e.preventDefault(); //stop the browser from following | |
83 | 643 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags'; |
0 | 644 }); |
645 | |
646 | |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
647 |
0 | 648 $('#instance-preview').live('click', function(e) { |
54
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
649 if ($.mobile.pageData) { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
650 GetSingleResource('instances', $.mobile.pageData.uuid + '/frames', function(frames) { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
651 if (frames.length == 1) |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
652 { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
653 // Viewing a single-frame image |
83 | 654 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
|
655 overlayFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
656 resizeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
657 imageFadeDuration : 1 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
658 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
659 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
660 else |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
661 { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
662 // Viewing a multi-frame image |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
663 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
664 var images = []; |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
665 for (var i = 0; i < frames.length; i++) { |
83 | 666 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
|
667 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
668 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
669 jQuery.slimbox(images, 0, { |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
670 overlayFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
671 resizeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
672 imageFadeDuration : 1, |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
673 loop : true |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
674 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
675 } |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
676 }); |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
677 |
42a449dac415
multi-frame images in the explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
45
diff
changeset
|
678 } |
0 | 679 }); |
680 | |
681 $('#series-preview').live('click', function(e) { | |
682 if ($.mobile.pageData) { | |
683 GetSingleResource('series', $.mobile.pageData.uuid, function(series) { | |
684 GetMultipleResources('instances', series.Instances, function(instances) { | |
80 | 685 Sort(instances, function(x) { return x.IndexInSeries; }, true, false); |
0 | 686 |
687 var images = []; | |
688 for (var i = 0; i < instances.length; i++) { | |
83 | 689 images.push([ '../instances/' + instances[i].ID + '/preview', |
0 | 690 '{0}/{1}'.format(i + 1, instances.length) ]) |
691 } | |
692 | |
693 jQuery.slimbox(images, 0, { | |
694 overlayFadeDuration : 1, | |
695 resizeDuration : 1, | |
696 imageFadeDuration : 1, | |
697 loop : true | |
698 }); | |
699 }) | |
700 }); | |
701 } | |
702 }); | |
703 | |
704 | |
705 | |
706 | |
707 | |
708 | |
709 function ChooseDicomModality(callback) | |
710 { | |
711 $.ajax({ | |
83 | 712 url: '../modalities', |
0 | 713 type: 'GET', |
714 dataType: 'json', | |
715 async: false, | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
716 cache: false, |
0 | 717 success: function(modalities) { |
718 var clickedModality = ''; | |
719 var items = $('<ul>') | |
720 .attr('data-role', 'listview'); | |
721 | |
722 for (var i = 0; i < modalities.length; i++) { | |
723 var modality = modalities[i]; | |
724 var item = $('<li>') | |
725 .html('<a href="#" rel="close">' + modality + '</a>') | |
726 .attr('modality', modality) | |
727 .click(function() { | |
728 clickedModality = $(this).attr('modality'); | |
729 }); | |
730 items.append(item); | |
731 } | |
732 | |
733 $('#dialog').simpledialog2({ | |
734 mode: 'blank', | |
735 animate: false, | |
736 headerText: 'DICOM modality', | |
737 headerClose: true, | |
738 width: '100%', | |
739 blankContent: items, | |
740 callbackClose: function() { | |
741 var timer; | |
742 function WaitForDialogToClose() { | |
743 if (!$('#dialog').is(':visible')) { | |
744 clearInterval(timer); | |
745 callback(clickedModality); | |
746 } | |
747 } | |
748 timer = setInterval(WaitForDialogToClose, 100); | |
749 } | |
750 }); | |
751 } | |
752 }); | |
753 } | |
754 | |
755 | |
756 $('#instance-store,#series-store').live('click', function(e) { | |
757 ChooseDicomModality(function(modality) { | |
758 if (modality != '') { | |
759 $.ajax({ | |
83 | 760 url: '../modalities/' + modality + '/store', |
0 | 761 type: 'POST', |
762 dataType: 'text', | |
763 data: $.mobile.pageData.uuid, | |
764 async: true, // Necessary to block UI | |
765 beforeSend: function() { | |
766 $.blockUI({ message: $('#loading') }); | |
767 }, | |
768 complete: function(s) { | |
769 $.unblockUI(); | |
770 }, | |
771 success: function(s) { | |
347 | 772 //console.log('done !'); |
0 | 773 }, |
774 error: function() { | |
775 alert('Error during C-Store'); | |
776 } | |
777 }); | |
778 | |
779 } | |
780 }); | |
781 }); | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
782 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
783 |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
784 $('#show-tag-name').live('change', function(e) { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
785 var checked = e.currentTarget.checked; |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
786 if (checked) |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
787 $('.tag-name').show(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
788 else |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
789 $('.tag-name').hide(); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
790 }); |
250
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
791 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
792 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
793 $('#patient-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
794 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
795 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
796 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
797 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
798 $('#study-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
799 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
800 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
801 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
802 |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
803 $('#series-archive').live('click', function(e) { |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
804 e.preventDefault(); //stop the browser from following |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
805 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive'; |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
806 }); |
f23318b11b39
creation of zip files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
807 |
274
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
808 $('#protection').live('change', function(e) { |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
809 var isProtected = e.target.value == "on"; |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
810 $.ajax({ |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
811 url: '../patients/' + $.mobile.pageData.uuid + '/protected', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
812 type: 'PUT', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
813 dataType: 'text', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
814 data: isProtected ? '1' : '0', |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
815 async: false |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
816 }); |
f2286c741109
patient protection in Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
250
diff
changeset
|
817 }); |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
818 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
819 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
820 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
821 function OpenAnonymizeResourceDialog(path, title) |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
822 { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
823 $(document).simpledialog2({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
824 mode: 'button', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
825 animate: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
826 headerText: title, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
827 headerClose: true, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
828 width: '500px', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
829 buttons : { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
830 'OK': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
831 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
832 $.ajax({ |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
833 url: path + '/anonymize', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
834 type: 'POST', |
354 | 835 data: '{ "Keep" : [ "SeriesDescription", "StudyDescription" ] }', |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
836 dataType: 'json', |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
837 async: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
838 cache: false, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
839 success: function(s) { |
351 | 840 // The following line does not work... |
841 //$.mobile.changePage('explorer.html#patient?uuid=' + s.PatientID); | |
842 | |
843 window.location.assign('explorer.html#patient?uuid=' + s.PatientID); | |
844 window.location.reload(); | |
344
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
845 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
846 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
847 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
848 icon: "delete", |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
849 theme: "c" |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
850 }, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
851 'Cancel': { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
852 click: function () { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
853 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
854 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
855 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
856 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
857 } |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
858 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
859 $('#instance-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
860 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
861 'Anonymize this instance?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
862 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
863 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
864 $('#study-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
865 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
866 'Anonymize this study?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
867 }); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
868 |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
869 $('#series-anonymize').live('click', function() { |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
870 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid, |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
871 'Anonymize this series?'); |
cd6749e53a03
anonymization from orthanc explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
274
diff
changeset
|
872 }); |
351 | 873 |
874 $('#patient-anonymize').live('click', function() { | |
875 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid, | |
876 'Anonymize this patient?'); | |
877 }); |