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