annotate Applications/StoneWebViewer/WebApplication/app.js @ 1761:28755e42c007

Fix issue #197 (Support for passing credentials with all HTTP requests)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 May 2021 11:51:53 +0200
parents 9ac2a65d4172
children 634ff8993f6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1739
9ac2a65d4172 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1721
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1593
diff changeset
16 *
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
22 var CONFIGURATION_SOURCE = 'configuration.json';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
23 var WASM_SOURCE = 'StoneWebViewer.js';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
24
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 var COLORS = [ 'blue', 'red', 'green', 'yellow', 'violet' ];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 var SERIES_INSTANCE_UID = '0020,000e';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 var STUDY_INSTANCE_UID = '0020,000d';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 var STUDY_DESCRIPTION = '0008,1030';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 var STUDY_DATE = '0008,0020';
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
30 var PATIENT_ID = '0010,0020';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
31 var PATIENT_NAME = '0010,0010';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
32 var SERIES_NUMBER = '0020,0011';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
33 var SERIES_DESCRIPTION = '0008,103e';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
34 var MODALITY = '0008,0060';
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
36 // Registry of the PDF series for which the instance metadata is still waiting
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
37 var pendingSeriesPdf_ = {};
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
38
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 function getParameterFromUrl(key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 var url = window.location.search.substring(1);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 var args = url.split('&');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 for (var i = 0; i < args.length; i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 var arg = args[i].split('=');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 if (arg[0] == key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 return arg[1];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
52 // https://stackoverflow.com/a/21797381/881731
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
53 function Base64ToArrayBuffer(base64) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
54 var binary_string = window.atob(base64);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
55 var len = binary_string.length;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
56 var bytes = new Uint8Array(len);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
57 for (var i = 0; i < len; i++) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
58 bytes[i] = binary_string.charCodeAt(i);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
59 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
60 return bytes.buffer;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
61 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
62
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
63
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
64 function SaveDataUriScheme(filename, dataUriScheme) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
65 var mimeType = dataUriScheme.split(',')[0].split(':')[1].split(';')[0];
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
66 var base64 = dataUriScheme.split(',')[1];
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
67
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
68 var blob = new Blob([ Base64ToArrayBuffer(base64) ], {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
69 type: mimeType
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
70 });
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
71
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
72 var link = document.createElement('a');
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
73 link.href = window.URL.createObjectURL(blob);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
74 link.download = filename;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
75 link.click();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
76 };
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
77
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
78
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
79 // Check out "enum WebViewerAction" in "StoneWebViewer.cpp" for the
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
80 // possible values
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
81 function ConvertMouseAction(config, defaultAction)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
82 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
83 if (config === undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
84 return defaultAction;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
85 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
86 if (config == "Windowing") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
87 return stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
88 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
89 else if (config == "Zoom") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
90 return stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
91 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
92 else if (config == "Pan") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
93 return stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
94 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
95 else if (config == "Rotate") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
96 return stone.WebViewerAction.ROTATE;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
97 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
98 else if (config == "Crosshair") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
99 return stone.WebViewerAction.CROSSHAIR;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
100 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
101 else {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
102 alert('Unsupported mouse action in the configuration file: ' + config);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
103 return stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
104 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
105 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
106
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
107
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
108 /**
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
109 * Enable support for tooltips in Bootstrap. This function must be
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
110 * called after each modification to the DOM that introduces new
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
111 * tooltips (e.g. after loading studies).
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
112 **/
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
113 function RefreshTooltips()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
114 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
115 $('[data-toggle="tooltip"]').tooltip({
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
116 placement: 'bottom',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
117 container: 'body',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
118 trigger: 'hover'
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
119 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
120 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
121
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
122
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
123
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 Vue.component('viewport', {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
125 props: [ 'left', 'top', 'width', 'height', 'canvasId', 'active', 'content', 'viewportIndex',
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
126 'showInfo', 'globalConfiguration' ],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 template: '#viewport-template',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 data: function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 stone: stone, // To access global object "stone" from "index.html"
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
131 status: 'waiting',
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
132 currentFrame: 0,
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
133 numberOfFrames: 0,
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
134 quality: '',
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
135 cineControls: false,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
136 cineIncrement: 0,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
137 cineFramesPerSecond: 30,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
138 cineTimeoutId: null,
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
139 cineLoadingFrame: false,
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
140 videoUri: '',
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
141 windowingCenter: 0,
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
142 windowingWidth: 0,
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
143 instanceNumber: 0
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
146 watch: {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
147 currentFrame: function(newVal, oldVal) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
148 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
149 * The "FrameUpdated" event has been received, which indicates
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
150 * that the schedule frame has been displayed: The cine loop can
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
151 * proceed to the next frame (check out "CineCallback()").
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
152 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
153 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
154 },
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
155 content: function(newVal, oldVal) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 this.status = 'loading';
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
157 this.cineControls = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
158 this.cineMode = '';
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
159 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
160 this.cineRate = 30; // Default value
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
161 this.windowingCenter = 0;
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
162 this.windowingWidth = 0;
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
163 this.instanceNumber = 0;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
164
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
165 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
166 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
167 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
168 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
170 var studyInstanceUid = newVal.series.tags[STUDY_INSTANCE_UID];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
171 var seriesInstanceUid = newVal.series.tags[SERIES_INSTANCE_UID];
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 stone.SpeedUpFetchSeriesMetadata(studyInstanceUid, seriesInstanceUid);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
173
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
174 if ((newVal.series.type == stone.ThumbnailType.IMAGE ||
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
175 newVal.series.type == stone.ThumbnailType.NO_PREVIEW) &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
176 newVal.series.complete) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 this.status = 'ready';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 var that = this;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 Vue.nextTick(function() {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
181 if (newVal.sopInstanceUid !== undefined &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
182 newVal.sopInstanceUid.length > 0) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
183 stone.LoadMultipartInstanceInViewport(
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
184 that.canvasId, seriesInstanceUid, newVal.sopInstanceUid);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
185 }
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
186 else {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
187 stone.LoadSeriesInViewport(that.canvasId, seriesInstanceUid);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
188 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
191 else if (newVal.series.type == stone.ThumbnailType.PDF) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
192 if (newVal.series.complete) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
193 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
194 * Series is complete <=> One already knows about the
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
195 * SOPInstanceUIDs that are available in this series. As a
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
196 * consequence,
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
197 * "OrthancStone::SeriesMetadataLoader::Accessor" will not
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
198 * be empty in "ResourcesLoader::FetchPdf()" in C++ code.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
199 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
200 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
201 } else {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
202 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
203 * The SOPInstanceUIDs in this series are not known
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
204 * yet. Schedule an "stone.FetchPdf()" one the series
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
205 * metadata is available.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
206 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
207 pendingSeriesPdf_[seriesInstanceUid] = true;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
208 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
209 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
210 else if (newVal.series.type == stone.ThumbnailType.VIDEO) {
1661
e4589378ad8b warning message about unsupported videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1657
diff changeset
211 this.status = 'video';
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
212 this.videoUri = '';
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
213 if (this.globalConfiguration.OrthancApiRoot) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
214 var that = this;
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
215 axios.post(that.globalConfiguration.OrthancApiRoot + '/tools/find',
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
216 {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
217 Level : 'Instance',
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
218 Query : {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
219 StudyInstanceUID: studyInstanceUid
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
220 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
221 })
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
222 .then(function(response) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
223 if (response.data.length != 1) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
224 throw('');
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
225 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
226 else {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
227 that.videoUri = that.globalConfiguration.OrthancApiRoot + '/instances/' + response.data[0] + '/frames/0/raw';
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
228 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
229 })
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
230 .catch(function(error) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
231 alert('Cannot find the video in Orthanc');
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
232 });
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
233 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
234 else {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
235 console.warn('Videos are not supported by the Stone Web viewer alone yet, the Orthanc REST API is needed');
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
236 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 },
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
240 mounted: function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
241 var that = this;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
242
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
243 window.addEventListener('FrameUpdated', function(args) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
244 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
245 that.currentFrame = (args.detail.currentFrame + 1);
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
246 that.numberOfFrames = args.detail.numberOfFrames;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
247 that.quality = args.detail.quality;
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
248 that.instanceNumber = args.detail.instanceNumber;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
249 }
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
250 });
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
251
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
252 window.addEventListener('SeriesDetailsReady', function(args) {
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
253 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
254 that.cineFramesPerSecond = stone.GetCineRate(that.canvasId);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
255 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
256 });
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
257
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
258 window.addEventListener('PdfLoaded', function(args) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
259 var studyInstanceUid = args.detail.studyInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
260 var seriesInstanceUid = args.detail.seriesInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
261 var pdfPointer = args.detail.pdfPointer;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
262 var pdfSize = args.detail.pdfSize;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
263
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
264 if ('tags' in that.content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
265 that.content.series.tags[STUDY_INSTANCE_UID] == studyInstanceUid &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
266 that.content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
267
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
268 that.status = 'pdf';
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
269 var pdf = new Uint8Array(HEAPU8.subarray(pdfPointer, pdfPointer + pdfSize));
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
270
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
271 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
272 * It is not possible to bind an "Uint8Array" to a "props"
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
273 * in the "pdf-viewer" component. So we have to directly
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
274 * call the method of a component. But, "$refs are only
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
275 * populated after the component has been rendered", so we
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
276 * wait for the next rendering.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
277 * https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
278 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
279 Vue.nextTick(function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
280 that.$refs.pdfViewer.LoadPdf(pdf);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
281 });
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
282 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
283 });
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
284
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
285 window.addEventListener('WindowingUpdated', function(args) {
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
286 if (args.detail.canvasId == that.canvasId) {
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
287 that.windowingCenter = args.detail.windowingCenter;
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
288 that.windowingWidth = args.detail.windowingWidth;
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
289 }
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
290 });
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
291 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 methods: {
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
293 DragDrop: function(event) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 event.preventDefault();
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
295
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
296 // The "parseInt()" is because of Microsoft Edge Legacy (*)
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
297 this.$emit('updated-series', {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
298 seriesIndex: parseInt(event.dataTransfer.getData('seriesIndex'), 10),
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
299 sopInstanceUid: event.dataTransfer.getData('sopInstanceUid')
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
300 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 MakeActive: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 this.$emit('selected-viewport');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
305 DecrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
306 return stone.DecrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
307 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
308 IncrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
309 return stone.IncrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
310 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
311 CinePlay: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
312 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
313 this.cineIncrement = 1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
314 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
315 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
316 CinePause: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
317 if (this.cineIncrement == 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
318 // Two clicks on the "pause" button will hide the playback control
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
319 this.cineControls = !this.cineControls;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
320 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
321 this.cineIncrement = 0;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
322 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
323 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
324 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
325 CineBackward: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
326 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
327 this.cineIncrement = -1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
328 this.UpdateCine();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
330 UpdateCine: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
331 // Cancel the previous cine loop, if any
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
332 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
333 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
334 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
335 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
336
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
337 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
338
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
339 if (this.cineIncrement != 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
340 this.CineCallback();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
341 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
342 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
343 CineCallback: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
344 var reschedule;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
345
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
346 if (this.cineLoadingFrame) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
347 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
348 * Wait until the frame scheduled by the previous call to
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
349 * "CineCallback()" is actually displayed (i.e. we monitor the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
350 * "FrameUpdated" event). Otherwise, the background loading
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
351 * process of the DICOM frames in C++ might be behind the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
352 * advancement of the current frame, which freezes the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
353 * display.
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
354 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
355 reschedule = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
356 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
357 this.cineLoadingFrame = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
358
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
359 if (this.cineIncrement == 1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
360 reschedule = this.DecrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
361 } else if (this.cineIncrement == -1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
362 reschedule = this.IncrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
363 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
364 reschedule = false; // Increment is zero, this test is just for safety
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
365 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
366 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
367
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
368 if (reschedule) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
369 this.cineTimeoutId = setTimeout(this.CineCallback, 1000.0 / this.cineFramesPerSecond);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
370 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 }
1651
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1616
diff changeset
373 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 var app = new Vue({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 el: '#wv',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 data: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 stone: stone, // To access global object "stone" from "index.html"
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 ready: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 leftMode: 'grid', // Can be 'small', 'grid' or 'full'
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 leftVisible: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 viewportLayoutButtonsVisible: false,
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
385 mouseActionsVisible: false,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 activeViewport: 0,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 showInfo: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 showReferenceLines: true,
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
389 synchronizedBrowsing: false,
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
390 globalConfiguration: {},
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
391 creatingArchive: false,
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
392 archiveJob: '',
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
393
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
394 modalWarning: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
395 modalNotDiagnostic: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
396 modalPreferences: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
397
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
398 // User preferences (stored in the local storage)
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
399 settingNotDiagnostic: true,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
400 settingSoftwareRendering: false,
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
401
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
402 layoutCountX: 1,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
403 layoutCountY: 1,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 viewport1Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 viewport1Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 viewport1Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 viewport1Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 viewport1Visible: true,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
410 viewport1Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 viewport2Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 viewport2Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 viewport2Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 viewport2Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 viewport2Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
417 viewport2Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 viewport3Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 viewport3Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 viewport3Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 viewport3Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 viewport3Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
424 viewport3Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 viewport4Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 viewport4Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 viewport4Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 viewport4Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 viewport4Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
431 viewport4Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
433 showWindowing: false,
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
434 windowingPresets: [],
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
435
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
436 selectedStudies: [],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 series: [],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 studies: [],
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
439 seriesIndex: {}, // Maps "SeriesInstanceUID" to "index in this.series"
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
440 multiframeInstanceThumbnails: {}
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 computed: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 getSelectedStudies() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 var s = '';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 for (var i = 0; i < this.studies.length; i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 if (this.studies[i].selected) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 if (s.length > 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 s += ', ';
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
450 s += this.studies[i].tags[STUDY_DESCRIPTION];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
451
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
452 var date = this.studies[i].tags[STUDY_DATE];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
453 if (date.length > 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
454 s += ' [' + this.FormatDate(date) + ']';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
455 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 if (s.length == 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 return '...';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 else
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 watch: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 leftVisible: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 showReferenceLines: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 stone.ShowReferenceLines(newVal ? 1 : 0);
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
470 },
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
471 synchronizedBrowsing: function(newVal, oldVal) {
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
472 stone.SetSynchronizedBrowsingEnabled(newVal ? 1 : 0);
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
473 },
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
474 settingNotDiagnostic: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
475 localStorage.settingNotDiagnostic = (newVal ? '1' : '0');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
476 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
477 settingSoftwareRendering: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
478 localStorage.settingSoftwareRendering = (newVal ? '1' : '0');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 methods: {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
482 FitContent: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 // This function can be used even if WebAssembly is not initialized yet
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 if (typeof stone._AllViewportsUpdateSize !== 'undefined') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 this.$nextTick(function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 stone.AllViewportsUpdateSize(true /* fit content */);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
491 GetActiveSeries: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 var s = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
494 if ('tags' in this.viewport1Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
495 s.push(this.viewport1Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
496
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
497 if ('tags' in this.viewport2Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
498 s.push(this.viewport2Content.series.tags[SERIES_INSTANCE_UID]);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
500 if ('tags' in this.viewport3Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
501 s.push(this.viewport3Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
502
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
503 if ('tags' in this.viewport4Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
504 s.push(this.viewport4Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
505
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
506 return s;
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
507 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
509 GetActiveMultiframeInstances: function() {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
510 var s = [];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
511
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
512 if ('sopInstanceUid' in this.viewport1Content)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
513 s.push(this.viewport1Content.sopInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
515 if ('sopInstanceUid' in this.viewport2Content)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
516 s.push(this.viewport2Content.sopInstanceUid);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
517
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
518 if ('sopInstanceUid' in this.viewport3Content)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
519 s.push(this.viewport3Content.sopInstanceUid);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
520
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
521 if ('sopInstanceUid' in this.viewport4Content)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
522 s.push(this.viewport4Content.sopInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
527 GetActiveCanvas: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 if (this.activeViewport == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 else if (this.activeViewport == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 return 'canvas2';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 else if (this.activeViewport == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 return 'canvas3';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 else if (this.activeViewport == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 return 'canvas4';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 SetResources: function(sourceStudies, sourceSeries) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 var indexStudies = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 var posColor = 0;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 for (var i = 0; i < sourceStudies.length; i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 var studyInstanceUid = sourceStudies[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 if (studyInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 console.error('Twice the same study: ' + studyInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 } else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 indexStudies[studyInstanceUid] = studies.length;
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
558
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
559 var isSelected = (this.selectedStudies.length == 0 ? true :
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
560 this.selectedStudies.includes(studyInstanceUid));
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 studies.push({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 'studyInstanceUid' : studyInstanceUid,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 'series' : [ ],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 'color' : COLORS[posColor],
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
566 'selected' : isSelected,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 'tags' : sourceStudies[i]
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 posColor = (posColor + 1) % COLORS.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 var seriesIndex = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 for (var i = 0; i < sourceSeries.length; i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 var studyInstanceUid = sourceSeries[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 var seriesInstanceUid = sourceSeries[i][SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 if (studyInstanceUid !== undefined &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 seriesInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 seriesIndex[seriesInstanceUid] = series.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 var study = studies[indexStudies[studyInstanceUid]];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 study.series.push(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 series.push({
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
588 'numberOfFrames' : 0,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 'complete' : false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 'type' : stone.ThumbnailType.LOADING,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 'color': study.color,
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
592 'tags': sourceSeries[i],
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
593 'multiframeInstances': null
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 this.studies = studies;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 this.series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 this.seriesIndex = seriesIndex;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 this.ready = true;
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
603
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
604 Vue.nextTick(function() {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
605 RefreshTooltips();
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
606 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 SeriesDragStart: function(event, seriesIndex) {
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
610 // It is necessary to use ".toString()" for Microsoft Edge Legacy (*)
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
611 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 },
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
613
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
614 MultiframeInstanceDragStart: function(event, seriesIndex, sopInstanceUid) {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
615 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
616 event.dataTransfer.setData('sopInstanceUid', sopInstanceUid.toString());
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
617 },
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
618
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
619 SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
620 if (seriesInstanceUid in this.seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
621 this.SetViewportSeries(viewportIndex, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
622 seriesIndex: this.seriesIndex[seriesInstanceUid]
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
623 });
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
624 }
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
625 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
627 SetViewportSeries: function(viewportIndex, info) {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
628 var series = this.series[info.seriesIndex];
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 if (viewportIndex == 1) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
631 this.viewport1Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
632 series: series,
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
633 sopInstanceUid: info.sopInstanceUid
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
634 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 else if (viewportIndex == 2) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
637 this.viewport2Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
638 series: series,
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
639 sopInstanceUid: info.sopInstanceUid
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
640 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 else if (viewportIndex == 3) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
643 this.viewport3Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
644 series: series,
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
645 sopInstanceUid: info.sopInstanceUid
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
646 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 else if (viewportIndex == 4) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
649 this.viewport4Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
650 series: series,
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
651 sopInstanceUid: info.sopInstanceUid
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
652 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 ClickSeries: function(seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
657 this.SetViewportSeries(this.activeViewport, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
658 seriesIndex: seriesIndex
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
659 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
662 ClickMultiframeInstance: function(seriesIndex, sopInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
663 this.SetViewportSeries(this.activeViewport, {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
664 seriesIndex: seriesIndex,
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
665 sopInstanceUid: sopInstanceUid
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
666 });
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
667 },
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
668
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 HideViewport: function(index) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 this.viewport1Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 this.viewport2Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 this.viewport3Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 this.viewport4Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 ShowViewport: function(index, left, top, width, height) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 this.viewport1Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 this.viewport1Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 this.viewport1Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 this.viewport1Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 this.viewport1Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 this.viewport2Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 this.viewport2Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 this.viewport2Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 this.viewport2Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 this.viewport2Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 this.viewport3Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 this.viewport3Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 this.viewport3Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 this.viewport3Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 this.viewport3Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 this.viewport4Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 this.viewport4Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 this.viewport4Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 this.viewport4Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 this.viewport4Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 SetViewportLayout: function(layout) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 this.viewportLayoutButtonsVisible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 if (layout == '1x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 this.ShowViewport(1, '0%', '0%', '100%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 this.HideViewport(2);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
722 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
723 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
725 else if (layout == '2x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 this.ShowViewport(1, '0%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 this.ShowViewport(2, '50%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 this.ShowViewport(3, '0%', '50%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 this.ShowViewport(4, '50%', '50%', '50%', '50%');
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
730 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
731 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 else if (layout == '2x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 this.ShowViewport(1, '0%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 this.ShowViewport(2, '50%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
738 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
739 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 else if (layout == '1x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 this.ShowViewport(1, '0%', '0%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 this.ShowViewport(2, '0%', '50%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
746 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
747 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 UpdateSeriesThumbnail: function(seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 var type = stone.LoadSeriesThumbnail(seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 series.type = type;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 if (type == stone.ThumbnailType.IMAGE) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 series.thumbnail = stone.GetStringBuffer();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 // https://fr.vuejs.org/2016/02/06/common-gotchas/#Why-isn%E2%80%99t-the-DOM-updating
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
770 UpdateIsSeriesComplete: function(studyInstanceUid, seriesInstanceUid) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
775 var oldComplete = series.complete;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
776
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 series.complete = stone.IsSeriesComplete(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
778
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
779 if (!oldComplete &&
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
780 series.complete)
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
781 {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
782 series.numberOfFrames = stone.GetSeriesNumberOfFrames(seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
783
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
784 if (seriesInstanceUid in pendingSeriesPdf_) {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
785 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
786 delete pendingSeriesPdf_[seriesInstanceUid];
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
787 }
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
788
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
789 if (stone.LoadMultiframeInstancesFromSeries(seriesInstanceUid)) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
790 series.multiframeInstances = JSON.parse(stone.GetStringBuffer());
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
791 }
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
792 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 // https://fr.vuejs.org/2016/02/06/common-gotchas/#Why-isn%E2%80%99t-the-DOM-updating
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
797 if ('tags' in this.viewport1Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
798 this.viewport1Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
799 this.$set(this.viewport1Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
802 if ('tags' in this.viewport2Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
803 this.viewport2Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
804 this.$set(this.viewport2Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
807 if ('tags' in this.viewport3Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
808 this.viewport3Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
809 this.$set(this.viewport3Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
812 if ('tags' in this.viewport4Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
813 this.viewport4Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
814 this.$set(this.viewport4Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
817 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
819 SetWindowing: function(center, width) {
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
820 this.showWindowing = false;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823 stone.SetWindowing(canvas, center, width);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
827 InvertContrast: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 stone.InvertContrast(canvas);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 }
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
832 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
833
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
834 FlipX: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
835 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
836 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
837 stone.FlipX(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
838 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
839 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
840
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
841 FlipY: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
842 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
843 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
844 stone.FlipY(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
845 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
846 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
847
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
848 ApplyPreferences: function() {
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
849 this.modalPreferences = false;
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
850
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
851 if ((stone.IsSoftwareRendering() != 0) != this.settingSoftwareRendering) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
852 document.location.reload();
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
853 }
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
854 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
855
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
856 HideAllTooltips: function() {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
857 $('[data-toggle="tooltip"]').tooltip('hide');
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
858 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
859
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
860 SetMouseButtonActions: function(left, middle, right) {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
861 this.mouseActionsVisible = false;
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
862 stone.SetMouseButtonActions(left, middle, right);
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
863 },
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
864
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
865 LoadOsiriXAnnotations: function(xml, clearPrevious)
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
866 {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
867 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
868 var seriesInstanceUid = stone.GetStringBuffer();
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
869
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
870 this.SetViewportLayout('1x1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
871 this.leftVisible = false;
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
872 this.SetViewportSeriesInstanceUid(1, seriesInstanceUid);
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
873
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
874 stone.FocusFirstOsiriXAnnotation('canvas1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
875 }
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
876 },
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
877
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
878 ToggleWindowing: function()
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
879 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
880 if (this.showWindowing)
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
881 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
882 this.showWindowing = false;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
883 }
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
884 else
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
885 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
886 stone.LoadWindowingPresets(this.GetActiveCanvas());
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
887 this.windowingPresets = JSON.parse(stone.GetStringBuffer());
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
888
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
889 var p = $('#windowing-popover').last();
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
890 var top = p.offset().top + p.height() + 10;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
891 $('#windowing-content').css('top', top);
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
892 //$('#windowing-content').css('right', '10');
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
893 //$('#windowing-content').css('left', 'auto');
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
894
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
895 this.showWindowing = true;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
896 }
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
897 },
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
898
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
899 FormatDate: function(date)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
900 {
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
901 if (date === undefined ||
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
902 date.length == 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
903 return '';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
904 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
905 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
906 var format = this.globalConfiguration['DateFormat'];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
907 if (format === undefined) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
908 // No configuration for the date format, use the DICOM tag as such
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
909 return date;
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
910 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
911 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
912 var year = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$1');
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
913 var month = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$2');
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
914 var day = date.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})$/, '$3');
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
915 return format.replace(/YYYY/g, year).replace(/MM/g, month).replace(/DD/g, day);
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
916 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
917 }
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
918 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
919
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
920 DownloadJpeg: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
921 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
922 var canvas = document.getElementById(this.GetActiveCanvas());
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
923 SaveDataUriScheme('StoneWebViewerScreenshot.jpg', canvas.toDataURL('image/jpeg'));
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
924 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
925
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
926 SetCombinedToolActions: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
927 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
928 var left = stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
929 var middle = stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
930 var right = stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
931
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
932 var behaviour = this.globalConfiguration['CombinedToolBehaviour'];
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
933 if (behaviour !== undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
934 left = ConvertMouseAction(behaviour['LeftMouseButton'], left);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
935 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
936 right = ConvertMouseAction(behaviour['RightMouseButton'], right);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
937 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
938
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
939 this.SetMouseButtonActions(left, middle, right);
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
940 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
941
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
942 CheckIsDownloadComplete: function()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
943 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
944 if (this.creatingArchive &&
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
945 this.archiveJob.length > 0) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
946
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
947 var that = this;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
948 axios.get(that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob)
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
949 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
950 console.log('Progress of archive job ' + that.archiveJob + ': ' + response.data['Progress'] + '%');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
951 var state = response.data['State'];
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
952 if (state == 'Success') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
953 that.creatingArchive = false;
1718
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
954 var uri = that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob + '/archive';
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
955
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
956 /**
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
957 * The use of "window.open()" below might be blocked
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
958 * (depending on the browser criteria to block popup).
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
959 * As a consequence, we prefer to set "window.location".
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
960 * https://www.nngroup.com/articles/the-top-ten-web-design-mistakes-of-1999/
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
961 **/
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
962 // window.open(uri, '_blank');
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
963 window.location = uri;
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
964 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
965 else if (state == 'Running') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
966 setTimeout(that.CheckIsDownloadComplete, 1000);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
967 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
968 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
969 alert('Error while creating the archive in Orthanc: ' + response.data['ErrorDescription']);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
970 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
971 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
972 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
973 .catch(function(error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
974 alert('The archive job is not available anymore in Orthanc');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
975 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
976 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
977 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
978 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
979
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
980 DownloadStudy: function(studyInstanceUid)
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
981 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
982 console.log('Creating archive for study: ' + studyInstanceUid);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
983
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
984 var that = this;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
985 axios.post(this.globalConfiguration.OrthancApiRoot + '/tools/lookup', studyInstanceUid)
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
986 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
987 if (response.data.length != 1) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
988 throw('');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
989 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
990 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
991 var orthancId = response.data[0]['ID'];
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
992 axios.post(that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId + '/archive',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
993 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
994 'Asynchronous' : true
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
995 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
996 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
997 that.creatingArchive = true;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
998 that.archiveJob = response.data.ID;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
999 setTimeout(that.CheckIsDownloadComplete, 1000);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1000 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1001 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1002 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1003 .catch(function (error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1004 alert('Cannot find the study in Orthanc');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1005 });
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1006 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 mounted: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1010 this.SetViewportLayout('1x1');
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1011
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1012 if (localStorage.settingNotDiagnostic) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1013 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1014 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1015
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1016 if (localStorage.settingSoftwareRendering) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1017 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1018 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1019
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1020 this.modalNotDiagnostic = this.settingNotDiagnostic;
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1021
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1022 var that = this;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1023
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1024 window.addEventListener('MultiframeInstanceThumbnailLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1025 that.$set(that.multiframeInstanceThumbnails, args.detail.sopInstanceUid, args.detail.thumbnail);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1026 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1027
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1028 window.addEventListener('ThumbnailLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1029 //var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1030 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1031 that.UpdateSeriesThumbnail(seriesInstanceUid);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1032 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1033
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1034 window.addEventListener('MetadataLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1035 var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1036 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1037 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1038 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 window.addEventListener('StoneInitialized', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1045 stone.Setup(Module);
1713
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1046 stone.SetDicomWebRoot(app.globalConfiguration.DicomWebRoot,
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1047 true /* assume "/rendered" is available in DICOMweb (could be a configuration option) */);
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1048 stone.SetSoftwareRendering(localStorage.settingSoftwareRendering == '1');
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1049
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1050 if ('DicomCacheSize' in app.globalConfiguration) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1051 stone.SetDicomCacheSize(app.globalConfiguration.DicomCacheSize);
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1052 }
1761
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1053
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1054 // Bearer token is new in Stone Web viewer 2.0
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1055 var token = getParameterFromUrl('token');
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1056 if (token !== undefined)
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1057 {
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1058 stone.AddHttpHeader('Authorization', 'Bearer ' + token);
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1059 }
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1060
1665
f62f685e0eb2 avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1661
diff changeset
1061 console.warn('Stone properly initialized');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1063 app.SetCombinedToolActions();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1064
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1065 var selectedStudies = getParameterFromUrl('selectedStudies');
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1066 var patient = getParameterFromUrl('patient');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1067 var study = getParameterFromUrl('study');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1068 var series = getParameterFromUrl('series');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1070 if (selectedStudies !== undefined) {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1071 app.selectedStudies = selectedStudies.split(',');
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1072 } else {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1073 app.selectedStudies = [];
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1074 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1075
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1076 if (study !== undefined &&
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1077 series !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1078 console.warn('Loading series: ' + series + ' from study: ' + study);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1079 stone.FetchSeries(study, series);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1080 app.leftMode = 'full';
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1081 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1082 else {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1083 var empty = true;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1084
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1085 if (study !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1086 var studies = study.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1087 if (studies.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1088 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1089 for (var i = 0; i < studies.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1090 console.warn('Loading study: ' + studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1091 stone.FetchStudy(studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1092 }
1691
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
1093 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1094 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1095
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1096 if (patient !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1097 var patients = patient.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1098 if (patients.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1099 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1100 for (var i = 0; i < patients.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1101 console.warn('Loading patient: ' + patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1102 stone.FetchPatient(patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1103 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1104 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1105 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1106
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1107 if (empty) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1108 alert('No study, nor patient was provided in the URL!');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1109 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1111 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1113
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 window.addEventListener('ResourcesLoaded', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 console.log('resources loaded');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118 for (var i = 0; i < stone.GetStudiesCount(); i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 stone.LoadStudyTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 studies.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124 for (var i = 0; i < stone.GetSeriesCount(); i++) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125 stone.LoadSeriesTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126 series.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1127 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1128
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 app.SetResources(studies, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 for (var i = 0; i < app.series.length; i++) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
1132 var studyInstanceUid = app.series[i].tags[STUDY_INSTANCE_UID];
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133 var seriesInstanceUid = app.series[i].tags[SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134 app.UpdateSeriesThumbnail(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
1135 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1137 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1139
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140 window.addEventListener('StoneException', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141 console.error('Exception catched in Stone');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1147 function ParseJsonWithComments(json)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1148 {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1149 if (typeof(json) == 'string') {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1150 // https://stackoverflow.com/a/62945875/881731
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1151 return JSON.parse(json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g,
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1152 (m, g) => g ? "" : m));
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1153 } else {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1154 return json;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1155 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1156 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159 $(document).ready(function() {
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1160 RefreshTooltips();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1162 //app.modalWarning = true;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1164 axios.get(CONFIGURATION_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1165 .then(function(response) {
1700
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1166 app.globalConfiguration = ParseJsonWithComments(response.data) ['StoneWebViewer'];
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1167
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1168 if (app.globalConfiguration === undefined) {
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1169 console.warn('Empty configuration file');
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1170 app.globalConfiguration = {};
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1171 }
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
1172
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1173 // Option 1: Loading script using plain HTML
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1174
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1175 /*
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1176 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1177 script.src = WASM_SOURCE;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1178 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1179 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1180 */
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1182 // Option 2: Loading script using AJAX (gives the opportunity to
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1183 // explicitly report errors)
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1184
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1185 axios.get(WASM_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1186 .then(function (response) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1187 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1188 script.innerHTML = response.data;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1189 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1190 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1191 })
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1192 .catch(function (error) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1193 alert('Cannot load the WebAssembly framework');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1194 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 })
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 .catch(function (error) {
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1197 alert('Cannot load the configuration file');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1198 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 // "Prevent Bootstrap dropdown from closing on clicks" for the list of
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 // studies: https://stackoverflow.com/questions/26639346
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204 $('.dropdown-menu').click(function(e) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 e.stopPropagation();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1208
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209 // Disable the selection of text using the mouse
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 document.onselectstart = new Function ('return false');
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1211
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1212
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1213 window.addEventListener('message', function(e) {
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1214 if ('type' in e.data) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1215 if (e.data.type == 'show-osirix-annotations') {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1216 var expectedOrigin = app.globalConfiguration['ExpectedMessageOrigin'];
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1217
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1218 if (expectedOrigin === undefined) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1219 alert('Dynamic actions are disabled in the Stone Web viewer, ' +
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1220 'set the configuration option "ExpectedMessageOrigin".');
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1221 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1222 else if (expectedOrigin != '*' &&
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1223 e.origin !== expectedOrigin) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1224 alert('Bad origin for a dynamic action in the Stone Web viewer: "' + e.origin +
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1225 '", whereas the message must have origin: "' + expectedOrigin + '"');
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1226 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1227 else if (e.data.type == 'show-osirix-annotations') {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1228 var clear = true; // Whether to clear previous annotations
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1229 if ('clear' in e.data) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1230 clear = e.data.clear;
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1231 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1232
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1233 app.LoadOsiriXAnnotations(e.data.xml, clear);
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1234 }
1611
787db80a5a1b new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1603
diff changeset
1235 }
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1236 else {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1237 console.log('Unknown type of dynamic action in the Stone Web viewer: ' + e.data.type);
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1238 }
1707
ee2b5990dfff remove annoying alert box in the server demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1706
diff changeset
1239 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1240 });