annotate OrthancExplorer/explorer.js @ 1575:f8aae45011c9

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