annotate OrthancExplorer/explorer.js @ 2164:13a9f265d5d3

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