annotate OrthancExplorer/query-retrieve.js @ 1949:d90f737f2dde

warn about the use of privileged ports
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Apr 2016 10:30:17 +0200
parents aaf368280f5a
children e0517f25919e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 function JavascriptDateToDicom(date)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 var s = date.toISOString();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 function GenerateDicomDate(days)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 var today = new Date();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 var other = new Date(today);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 other.setDate(today.getDate() + days);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 return JavascriptDateToDicom(other);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 $('#query-retrieve').live('pagebeforeshow', function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 url: '../modalities',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 cache: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 success: function(modalities) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 var target = $('#qr-server');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 $('option', target).remove();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 for (var i = 0; i < modalities.length; i++) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 var option = $('<option>').text(modalities[i]);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 target.append(option);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 target.selectmenu('refresh');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 var target = $('#qr-date');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 $('option', target).remove();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 target.append($('<option>').attr('value', '*').text('Any date'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 target.append($('<option>').attr('value', GenerateDicomDate(-1)).text('Yesterday'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 target.append($('<option>').attr('value', GenerateDicomDate(-7) + '-').text('Last 7 days'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 target.append($('<option>').attr('value', GenerateDicomDate(-31) + '-').text('Last 31 days'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 target.append($('<option>').attr('value', GenerateDicomDate(-31 * 3) + '-').text('Last 3 months'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 target.append($('<option>').attr('value', GenerateDicomDate(-365) + '-').text('Last year'));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 target.selectmenu('refresh');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
1501
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
48 $('#qr-echo').live('click', function() {
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
49 var server = $('#qr-server').val();
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
50 var message = 'Error: The C-Echo has failed!';
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
51
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
52 $.ajax({
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
53 url: '../modalities/' + server + '/echo',
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
54 type: 'POST',
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
55 cache: false,
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
56 async: false,
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
57 success: function() {
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
58 message = 'The C-Echo has succeeded!';
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
59 }
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
60 });
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
61
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
62 $('<div>').simpledialog2({
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
63 mode: 'button',
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
64 headerText: 'Echo result',
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
65 headerClose: true,
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
66 buttonPrompt: message,
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
67 animate: false,
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
68 buttons : {
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
69 'OK': { click: function () { } }
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
70 }
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
71 });
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
72
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
73 return false;
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
74 });
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
75
aaf368280f5a C-Echo testing can be triggered from Orthanc Explorer (in the query/retrieve page)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1373
diff changeset
76
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 $('#qr-submit').live('click', function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 var query = {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 'Level' : 'Study',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 'Query' : {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 'AccessionNumber' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 'PatientBirthDate' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 'PatientID' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 'PatientName' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 'PatientSex' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 'SpecificCharacterSet' : 'ISO_IR 192', // UTF-8
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 'StudyDate' : $('#qr-date').val(),
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 'StudyDescription' : '*'
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 };
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 var field = $('#qr-fields input:checked').val();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 query['Query'][field] = $('#qr-value').val().toUpperCase();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 var modalities = '';
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 $('#qr-modalities input:checked').each(function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 var s = $(this).attr('name');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 if (modalities == '*')
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 modalities = s;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 else
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 modalities += '\\' + s;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 if (modalities.length > 0) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 query['Query']['ModalitiesInStudy'] = modalities;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 var server = $('#qr-server').val();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 url: '../modalities/' + server + '/query',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 type: 'POST',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 data: JSON.stringify(query),
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 error: function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 alert('Error during query (C-Find)');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 },
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 success: function(result) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 window.location.assign('explorer.html#query-retrieve-2?server=' + server + '&uuid=' + result['ID']);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 return false;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 function Retrieve(url)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 url: '../system',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 success: function(system) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 $('<div>').simpledialog2({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 mode: 'button',
1373
21a2929e541d Move SCU conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1371
diff changeset
138 headerText: 'Target',
1371
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 headerClose: true,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 buttonPrompt: 'Enter Application Entity Title (AET):',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 buttonInput: true,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 buttonInputDefault: system['DicomAet'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 buttons : {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 'OK': {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 click: function () {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 var aet = $.mobile.sdLastInput;
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 if (aet.length == 0)
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 aet = system['DicomAet'];
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 url: url,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 type: 'POST',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 async: true, // Necessary to block UI
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 dataType: 'text',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 data: aet,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 beforeSend: function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 $.blockUI({ message: $('#info-retrieve') });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 },
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 complete: function(s) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 $.unblockUI();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 },
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 error: function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 alert('Error during retrieve');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 $('#query-retrieve-2').live('pagebeforeshow', function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 if ($.mobile.pageData) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 var uri = '../queries/' + $.mobile.pageData.uuid + '/answers';
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 url: uri,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 success: function(answers) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 var target = $('#query-retrieve-2 ul');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 $('li', target).remove();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 for (var i = 0; i < answers.length; i++) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 url: uri + '/' + answers[i] + '/content?simplify',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 success: function(study) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 var series = '#query-retrieve-3?server=' + $.mobile.pageData.server + '&uuid=' + study['StudyInstanceUID'];
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 var info = $('<a>').attr('href', series).html(
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 ('<h3>{0} - {1}</h3>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 '<p>Accession number: <b>{2}</b></p>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 '<p>Birth date: <b>{3}</b></p>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 '<p>Patient sex: <b>{4}</b></p>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 '<p>Study description: <b>{5}</b></p>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 '<p>Study date: <b>{6}</b></p>').format(
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 study['PatientID'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 study['PatientName'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 study['AccessionNumber'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 FormatDicomDate(study['PatientBirthDate']),
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 study['PatientSex'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 study['StudyDescription'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 FormatDicomDate(study['StudyDate'])));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 var studyUri = uri + '/' + answers[i] + '/retrieve';
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 var retrieve = $('<a>').text('Retrieve').click(function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 Retrieve(studyUri);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 target.append($('<li>').append(info).append(retrieve));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 target.listview('refresh');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 $('#query-retrieve-3').live('pagebeforeshow', function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 if ($.mobile.pageData) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 var query = {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 'Level' : 'Series',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 'Query' : {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 'Modality' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 'ProtocolName' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 'SeriesDescription' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 'SeriesInstanceUID' : '*',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 'StudyInstanceUID' : $.mobile.pageData.uuid
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 };
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 url: '../modalities/' + $.mobile.pageData.server + '/query',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 type: 'POST',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 data: JSON.stringify(query),
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 error: function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 alert('Error during query (C-Find)');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 },
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 success: function(answer) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 var uri = '../queries/' + answer['ID'] + '/answers';
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 url: uri,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 success: function(answers) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 var target = $('#query-retrieve-3 ul');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 $('li', target).remove();
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 for (var i = 0; i < answers.length; i++) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 $.ajax({
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 url: uri + '/' + answers[i] + '/content?simplify',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 dataType: 'json',
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 async: false,
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 success: function(series) {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 var info = $('<a>').html(
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 ('<h3>{0}</h3>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 '<p>Modality: <b>{1}</b></p>' +
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 '<p>Protocol name: <b>{2}</b></p>'
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 ).format(
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 series['SeriesDescription'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 series['Modality'],
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 series['ProtocolName']
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 ));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 var seriesUri = uri + '/' + answers[i] + '/retrieve';
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 var retrieve = $('<a>').text('Retrieve').click(function() {
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 Retrieve(seriesUri);
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 target.append($('<li>').append(info).append(retrieve));
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 target.listview('refresh');
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 });
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 }
f528849ee9f7 DICOM Query/Retrieve available from Orthanc Explorer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 });