annotate Applications/StoneWebViewer/WebApplication/app.js @ 1859:58681a5c727b

overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
author Alain Mazy <am@osimis.io>
date Mon, 20 Sep 2021 17:08:23 +0200
parents 023cce3d7844
children 9290d2916150
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';
1807
634ff8993f6a Stone Web viewer: Patient birth date is now displayed in the overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
35 var PATIENT_BIRTH_DATE = '0010,0030';
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
37 // 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
38 var pendingSeriesPdf_ = {};
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
39
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
40 var MOUSE_TOOL_COMBINED = 1;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
41 var MOUSE_TOOL_ZOOM = 2;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
42 var MOUSE_TOOL_PAN = 3;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
43 var MOUSE_TOOL_CROSSHAIR = 4;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
44 var MOUSE_TOOL_CREATE_SEGMENT = 5;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
45 var MOUSE_TOOL_CREATE_ANGLE = 6;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
46 var MOUSE_TOOL_CREATE_CIRCLE = 7;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
47 var MOUSE_TOOL_REMOVE_MEASURE = 8;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
48
1495
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 function getParameterFromUrl(key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 var url = window.location.search.substring(1);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 var args = url.split('&');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 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
54 var arg = args[i].split('=');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 if (arg[0] == key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return arg[1];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
62 // https://stackoverflow.com/a/21797381/881731
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
63 function Base64ToArrayBuffer(base64) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
64 var binary_string = window.atob(base64);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
65 var len = binary_string.length;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
66 var bytes = new Uint8Array(len);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
67 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
68 bytes[i] = binary_string.charCodeAt(i);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
69 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
70 return bytes.buffer;
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
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
73
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
74 function SaveDataUriScheme(filename, dataUriScheme) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
75 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
76 var base64 = dataUriScheme.split(',')[1];
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 var blob = new Blob([ Base64ToArrayBuffer(base64) ], {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
79 type: mimeType
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
80 });
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
81
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
82 var link = document.createElement('a');
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
83 link.href = window.URL.createObjectURL(blob);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
84 link.download = filename;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
85 link.click();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
86 };
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
87
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 // 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
90 // possible values
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
91 function ConvertMouseAction(config, defaultAction)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
92 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
93 if (config === undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
94 return defaultAction;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
95 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
96 if (config == "Windowing") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
97 return stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
98 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
99 else if (config == "Zoom") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
100 return stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
101 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
102 else if (config == "Pan") {
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 else if (config == "Rotate") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
106 return stone.WebViewerAction.ROTATE;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
107 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
108 else if (config == "Crosshair") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
109 return stone.WebViewerAction.CROSSHAIR;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
110 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
111 else {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
112 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
113 return stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
114 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
115 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
116
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
117
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
118 /**
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
119 * 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
120 * 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
121 * tooltips (e.g. after loading studies).
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
122 **/
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
123 function RefreshTooltips()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
124 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
125 $('[data-toggle="tooltip"]').tooltip({
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
126 placement: 'bottom',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
127 container: 'body',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
128 trigger: 'hover'
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
129 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
130 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
131
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
132
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
133
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 Vue.component('viewport', {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
135 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
136 'showInfo', 'globalConfiguration' ],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 template: '#viewport-template',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 data: function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 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
141 status: 'waiting',
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
142 currentFrame: 0,
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
143 numberOfFrames: 0,
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
144 quality: '',
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
145 cineControls: false,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
146 cineIncrement: 0,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
147 cineFramesPerSecond: 30,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
148 cineTimeoutId: null,
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
149 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
150 videoUri: '',
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
151 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
152 windowingWidth: 0,
1859
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
153 instanceNumber: 0,
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
154 contentDate: '',
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
155 contentTime: '',
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
158 watch: {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
159 currentFrame: function(newVal, oldVal) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
160 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
161 * The "FrameUpdated" event has been received, which indicates
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
162 * 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
163 * proceed to the next frame (check out "CineCallback()").
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 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
166 },
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
167 content: function(newVal, oldVal) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 this.status = 'loading';
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
169 this.cineControls = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
170 this.cineMode = '';
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
171 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
172 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
173 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
174 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
175 this.instanceNumber = 0;
1859
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
176 this.contentDate = '';
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
177 this.contentTime = ''
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
178
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
179 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
180 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
181 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
182 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
184 var studyInstanceUid = newVal.series.tags[STUDY_INSTANCE_UID];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
185 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
186 stone.SpeedUpFetchSeriesMetadata(studyInstanceUid, seriesInstanceUid);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
187
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
188 if ((newVal.series.type == stone.ThumbnailType.IMAGE ||
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
189 newVal.series.type == stone.ThumbnailType.NO_PREVIEW) &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
190 newVal.series.complete) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 this.status = 'ready';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 var that = this;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 Vue.nextTick(function() {
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
195 if (newVal.virtualSeriesId !== undefined &&
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
196 newVal.virtualSeriesId.length > 0) {
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
197 stone.LoadVirtualSeriesInViewport(that.canvasId, newVal.virtualSeriesId);
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
198 }
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
199 else {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
200 stone.LoadSeriesInViewport(that.canvasId, seriesInstanceUid);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
201 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
204 else if (newVal.series.type == stone.ThumbnailType.PDF) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
205 if (newVal.series.complete) {
1657
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 * Series is complete <=> One already knows about the
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
208 * SOPInstanceUIDs that are available in this series. As a
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
209 * consequence,
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
210 * "OrthancStone::SeriesMetadataLoader::Accessor" will not
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
211 * be empty in "ResourcesLoader::FetchPdf()" in C++ code.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
212 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
213 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
214 } else {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
215 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
216 * The SOPInstanceUIDs in this series are not known
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
217 * yet. Schedule an "stone.FetchPdf()" one the series
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
218 * metadata is available.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
219 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
220 pendingSeriesPdf_[seriesInstanceUid] = true;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
221 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
222 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
223 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
224 this.status = 'video';
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
225 this.videoUri = '';
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
226 if (this.globalConfiguration.OrthancApiRoot) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
227 var that = this;
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
228 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
229 {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
230 Level : 'Instance',
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
231 Query : {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
232 StudyInstanceUID: studyInstanceUid
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 })
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
235 .then(function(response) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
236 if (response.data.length != 1) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
237 throw('');
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
238 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
239 else {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
240 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
241 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
242 })
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
243 .catch(function(error) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
244 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
245 });
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
246 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
247 else {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
248 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
249 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 },
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
253 mounted: function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
254 var that = this;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
255
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
256 window.addEventListener('FrameUpdated', function(args) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
257 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
258 that.currentFrame = (args.detail.currentFrame + 1);
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
259 that.numberOfFrames = args.detail.numberOfFrames;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
260 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
261 that.instanceNumber = args.detail.instanceNumber;
1859
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
262 that.contentDate = args.detail.contentDate;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
263 that.contentTime = args.detail.contentTime;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
264 }
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
265 });
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
266
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
267 window.addEventListener('SeriesDetailsReady', function(args) {
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
268 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
269 that.cineFramesPerSecond = stone.GetCineRate(that.canvasId);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
270 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
271 });
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
272
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
273 window.addEventListener('PdfLoaded', function(args) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
274 var studyInstanceUid = args.detail.studyInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
275 var seriesInstanceUid = args.detail.seriesInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
276 var pdfPointer = args.detail.pdfPointer;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
277 var pdfSize = args.detail.pdfSize;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
278
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
279 if ('tags' in that.content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
280 that.content.series.tags[STUDY_INSTANCE_UID] == studyInstanceUid &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
281 that.content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
1657
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 that.status = 'pdf';
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
284 var pdf = new Uint8Array(HEAPU8.subarray(pdfPointer, pdfPointer + pdfSize));
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
285
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
286 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
287 * 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
288 * 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
289 * 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
290 * populated after the component has been rendered", so we
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
291 * wait for the next rendering.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
292 * 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
293 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
294 Vue.nextTick(function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
295 that.$refs.pdfViewer.LoadPdf(pdf);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
296 });
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
297 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
298 });
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
299
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
300 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
301 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
302 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
303 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
304 }
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
305 });
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
306 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 methods: {
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
308 DragDrop: function(event) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 event.preventDefault();
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
310
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
311 // The "parseInt()" is because of Microsoft Edge Legacy (*)
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
312 this.$emit('updated-series', {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
313 seriesIndex: parseInt(event.dataTransfer.getData('seriesIndex'), 10),
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
314 virtualSeriesId: event.dataTransfer.getData('virtualSeriesId')
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
315 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 MakeActive: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 this.$emit('selected-viewport');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
320 DecrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
321 return stone.DecrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
322 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
323 IncrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
324 return stone.IncrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
325 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
326 CinePlay: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
327 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
328 this.cineIncrement = 1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
329 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
330 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
331 CinePause: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
332 if (this.cineIncrement == 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
333 // 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
334 this.cineControls = !this.cineControls;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
335 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
336 this.cineIncrement = 0;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
337 this.UpdateCine();
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 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
340 CineBackward: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
341 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
342 this.cineIncrement = -1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
343 this.UpdateCine();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
345 UpdateCine: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
346 // Cancel the previous cine loop, if any
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
347 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
348 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
349 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
350 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
351
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
352 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
353
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
354 if (this.cineIncrement != 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
355 this.CineCallback();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
356 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
357 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
358 CineCallback: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
359 var reschedule;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
360
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
361 if (this.cineLoadingFrame) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
362 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
363 * 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
364 * "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
365 * "FrameUpdated" event). Otherwise, the background loading
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
366 * 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
367 * advancement of the current frame, which freezes the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
368 * display.
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
369 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
370 reschedule = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
371 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
372 this.cineLoadingFrame = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
373
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
374 if (this.cineIncrement == 1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
375 reschedule = this.DecrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
376 } else if (this.cineIncrement == -1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
377 reschedule = this.IncrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
378 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
379 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
380 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
381 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
382
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
383 if (reschedule) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
384 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
385 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 }
1651
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1616
diff changeset
388 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 var app = new Vue({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 el: '#wv',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 data: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 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
396 ready: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 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
398 leftVisible: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 viewportLayoutButtonsVisible: false,
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
400 mouseActionsVisible: false,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 activeViewport: 0,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 showInfo: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 showReferenceLines: true,
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
404 synchronizedBrowsing: false,
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
405 globalConfiguration: {},
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
406 creatingArchive: false,
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
407 archiveJob: '',
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
408 mouseTool: 0,
1843
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
409 orthancSystem: {}, // Only available if "OrthancApiRoot" configuration option is set
1827
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
410 stoneWebViewerVersion: '...',
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
411 emscriptenVersion: '...',
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
412
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
413 modalWarning: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
414 modalNotDiagnostic: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
415 modalPreferences: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
416
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
417 // 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
418 settingNotDiagnostic: true,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
419 settingSoftwareRendering: false,
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
420
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
421 layoutCountX: 1,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
422 layoutCountY: 1,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 viewport1Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 viewport1Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 viewport1Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 viewport1Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 viewport1Visible: true,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
429 viewport1Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 viewport2Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 viewport2Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 viewport2Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 viewport2Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 viewport2Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
436 viewport2Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 viewport3Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 viewport3Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 viewport3Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 viewport3Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 viewport3Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
443 viewport3Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 viewport4Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 viewport4Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 viewport4Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 viewport4Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 viewport4Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
450 viewport4Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
452 showWindowing: false,
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
453 windowingPresets: [],
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
454
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
455 selectedStudies: [],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 series: [],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 studies: [],
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
458 seriesIndex: {}, // Maps "SeriesInstanceUID" to "index in this.series"
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
459 virtualSeriesThumbnails: {}
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 computed: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 getSelectedStudies() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 var s = '';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 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
466 if (this.studies[i].selected) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 if (s.length > 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 s += ', ';
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
469 s += this.studies[i].tags[STUDY_DESCRIPTION];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
470
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
471 var date = this.studies[i].tags[STUDY_DATE];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
472 if (date.length > 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
473 s += ' [' + this.FormatDate(date) + ']';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
474 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 if (s.length == 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 return '...';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
479 else
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
480 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 watch: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 leftVisible: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 showReferenceLines: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 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
489 },
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
490 synchronizedBrowsing: function(newVal, oldVal) {
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
491 stone.SetSynchronizedBrowsingEnabled(newVal ? 1 : 0);
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
492 },
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
493 settingNotDiagnostic: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
494 localStorage.settingNotDiagnostic = (newVal ? '1' : '0');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
495 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
496 settingSoftwareRendering: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
497 localStorage.settingSoftwareRendering = (newVal ? '1' : '0');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 methods: {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
501 FitContent: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 // 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
503 if (typeof stone._AllViewportsUpdateSize !== 'undefined') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 this.$nextTick(function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 stone.AllViewportsUpdateSize(true /* fit content */);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
510 GetActiveSeries: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 var s = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
513 if ('tags' in this.viewport1Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
514 s.push(this.viewport1Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
515
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
516 if ('tags' in this.viewport2Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
517 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
518
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
519 if ('tags' in this.viewport3Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
520 s.push(this.viewport3Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
521
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
522 if ('tags' in this.viewport4Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
523 s.push(this.viewport4Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
524
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
525 return s;
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
526 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
528 GetActiveVirtualSeries: function() {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
529 var s = [];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
530
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
531 if ('virtualSeriesId' in this.viewport1Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
532 s.push(this.viewport1Content.virtualSeriesId);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
534 if ('virtualSeriesId' in this.viewport2Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
535 s.push(this.viewport2Content.virtualSeriesId);
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
536
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
537 if ('virtualSeriesId' in this.viewport3Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
538 s.push(this.viewport3Content.virtualSeriesId);
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
539
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
540 if ('virtualSeriesId' in this.viewport4Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
541 s.push(this.viewport4Content.virtualSeriesId);
1495
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 return s;
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
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
546 GetActiveCanvas: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 if (this.activeViewport == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
550 else if (this.activeViewport == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
551 return 'canvas2';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 else if (this.activeViewport == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 return 'canvas3';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 else if (this.activeViewport == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 return 'canvas4';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
559 else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560 return 'canvas1';
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 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 SetResources: function(sourceStudies, sourceSeries) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 var indexStudies = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 var posColor = 0;
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 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
571 var studyInstanceUid = sourceStudies[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 if (studyInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 console.error('Twice the same study: ' + studyInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 } else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 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
577
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
578 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
579 this.selectedStudies.includes(studyInstanceUid));
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 studies.push({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 'studyInstanceUid' : studyInstanceUid,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 'series' : [ ],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 'color' : COLORS[posColor],
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
585 'selected' : isSelected,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 'tags' : sourceStudies[i]
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 posColor = (posColor + 1) % COLORS.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 var seriesIndex = {};
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 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
598 var studyInstanceUid = sourceSeries[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 var seriesInstanceUid = sourceSeries[i][SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 if (studyInstanceUid !== undefined &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 seriesInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 seriesIndex[seriesInstanceUid] = series.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 var study = studies[indexStudies[studyInstanceUid]];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 study.series.push(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 series.push({
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
607 'numberOfFrames' : 0,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 'complete' : false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 'type' : stone.ThumbnailType.LOADING,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 'color': study.color,
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
611 'tags': sourceSeries[i],
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
612 'virtualSeries': null
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 this.studies = studies;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 this.series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 this.seriesIndex = seriesIndex;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 this.ready = true;
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
622
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
623 Vue.nextTick(function() {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
624 RefreshTooltips();
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
625 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 SeriesDragStart: function(event, seriesIndex) {
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
629 // 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
630 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 },
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
632
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
633 VirtualSeriesDragStart: function(event, seriesIndex, virtualSeriesId) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
634 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
635 event.dataTransfer.setData('virtualSeriesId', virtualSeriesId.toString());
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
636 },
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
637
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
638 SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
639 if (seriesInstanceUid in this.seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
640 this.SetViewportSeries(viewportIndex, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
641 seriesIndex: this.seriesIndex[seriesInstanceUid]
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
642 });
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
643 }
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
644 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
646 SetViewportSeries: function(viewportIndex, info) {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
647 var series = this.series[info.seriesIndex];
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 if (viewportIndex == 1) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
650 this.viewport1Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
651 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
652 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
653 };
1495
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 else if (viewportIndex == 2) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
656 this.viewport2Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
657 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
658 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
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 else if (viewportIndex == 3) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
662 this.viewport3Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
663 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
664 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
665 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 else if (viewportIndex == 4) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
668 this.viewport4Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
669 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
670 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
671 };
1495
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 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 ClickSeries: function(seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
676 this.SetViewportSeries(this.activeViewport, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
677 seriesIndex: seriesIndex
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
678 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
681 ClickVirtualSeries: function(seriesIndex, virtualSeriesId) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
682 this.SetViewportSeries(this.activeViewport, {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
683 seriesIndex: seriesIndex,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
684 virtualSeriesId: virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
685 });
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
686 },
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
687
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 HideViewport: function(index) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 this.viewport1Visible = false;
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 = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 this.viewport3Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 this.viewport4Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 ShowViewport: function(index, left, top, width, height) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 this.viewport1Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 this.viewport1Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 this.viewport1Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 this.viewport1Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 this.viewport1Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 this.viewport2Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 this.viewport2Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 this.viewport2Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 this.viewport2Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 this.viewport2Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 this.viewport3Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 this.viewport3Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 this.viewport3Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 this.viewport3Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 this.viewport3Height = height;
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 (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 this.viewport4Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 this.viewport4Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 this.viewport4Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 this.viewport4Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 this.viewport4Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 }
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
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 SetViewportLayout: function(layout) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 this.viewportLayoutButtonsVisible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 if (layout == '1x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 this.ShowViewport(1, '0%', '0%', '100%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 this.HideViewport(2);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
741 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
742 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 else if (layout == '2x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 this.ShowViewport(1, '0%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 this.ShowViewport(2, '50%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 this.ShowViewport(3, '0%', '50%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 this.ShowViewport(4, '50%', '50%', '50%', '50%');
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
749 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
750 this.layoutCountY = 2;
1495
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 else if (layout == '2x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 this.ShowViewport(1, '0%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 this.ShowViewport(2, '50%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
757 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
758 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 else if (layout == '1x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 this.ShowViewport(1, '0%', '0%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 this.ShowViewport(2, '0%', '50%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
765 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
766 this.layoutCountY = 2;
1495
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 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 UpdateSeriesThumbnail: function(seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 var type = stone.LoadSeriesThumbnail(seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 series.type = type;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 if (type == stone.ThumbnailType.IMAGE) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 series.thumbnail = stone.GetStringBuffer();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 // 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
785 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
789 UpdateIsSeriesComplete: function(studyInstanceUid, seriesInstanceUid) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
794 var oldComplete = series.complete;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
795
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 series.complete = stone.IsSeriesComplete(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
797
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
798 if (!oldComplete &&
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
799 series.complete)
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
800 {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
801 series.numberOfFrames = stone.GetSeriesNumberOfFrames(seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
802
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
803 if (seriesInstanceUid in pendingSeriesPdf_) {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
804 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
805 delete pendingSeriesPdf_[seriesInstanceUid];
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
806 }
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
807
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
808 if (stone.LookupVirtualSeries(seriesInstanceUid)) {
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
809 series.virtualSeries = JSON.parse(stone.GetStringBuffer());
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
810 }
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
811 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813 // 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
814 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
816 if ('tags' in this.viewport1Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
817 this.viewport1Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
818 this.$set(this.viewport1Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
821 if ('tags' in this.viewport2Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
822 this.viewport2Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
823 this.$set(this.viewport2Content.series, series);
1495
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
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
826 if ('tags' in this.viewport3Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
827 this.viewport3Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
828 this.$set(this.viewport3Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
831 if ('tags' in this.viewport4Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
832 this.viewport4Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
833 this.$set(this.viewport4Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
838 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
839 this.showWindowing = false;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 stone.SetWindowing(canvas, center, width);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
846 InvertContrast: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
848 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 stone.InvertContrast(canvas);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 }
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
851 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
852
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
853 FlipX: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
854 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
855 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
856 stone.FlipX(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
857 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
858 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
859
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
860 FlipY: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
861 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
862 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
863 stone.FlipY(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
864 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
865 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
866
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
867 ApplyPreferences: function() {
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
868 this.modalPreferences = false;
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
869
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
870 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
871 document.location.reload();
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
872 }
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
873 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
874
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
875 HideAllTooltips: function() {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
876 $('[data-toggle="tooltip"]').tooltip('hide');
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
877 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
878
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
879 SetMouseButtonActions: function(tool, left, middle, right) {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
880 this.mouseActionsVisible = false;
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
881 this.mouseTool = tool;
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
882 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
883 },
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
884
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
885 SetLeftMouseButtonAction: function(tool, left) {
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
886 this.mouseActionsVisible = false;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
887 this.mouseTool = tool;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
888 stone.SetMouseButtonActions(left, stone.GetMiddleMouseButtonAction(),
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
889 stone.GetRightMouseButtonAction());
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
890 },
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
891
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
892 LoadOsiriXAnnotations: function(xml, clearPrevious)
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
893 {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
894 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
895 var seriesInstanceUid = stone.GetStringBuffer();
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
896
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
897 this.SetViewportLayout('1x1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
898 this.leftVisible = false;
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
899 this.SetViewportSeriesInstanceUid(1, seriesInstanceUid);
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
900
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
901 stone.FocusFirstOsiriXAnnotation('canvas1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
902 }
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
903 },
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
904
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
905 ToggleWindowing: function()
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
906 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
907 if (this.showWindowing)
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
908 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
909 this.showWindowing = false;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
910 }
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
911 else
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
912 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
913 stone.LoadWindowingPresets(this.GetActiveCanvas());
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
914 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
915
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
916 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
917 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
918 $('#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
919 //$('#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
920 //$('#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
921
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
922 this.showWindowing = true;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
923 }
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
924 },
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
925
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
926 FormatDate: function(date)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
927 {
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
928 if (date === undefined ||
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
929 date.length == 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
930 return '';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
931 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
932 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
933 var format = this.globalConfiguration['DateFormat'];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
934 if (format === undefined) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
935 // 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
936 return date;
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
937 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
938 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
939 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
940 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
941 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
942 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
943 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
944 }
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
945 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
946
1859
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
947 FormatTime: function(time)
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
948 {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
949 if (time === undefined ||
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
950 time.length == 0) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
951 return '';
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
952 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
953 else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
954 var format = this.globalConfiguration['TimeFormat'];
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
955 if (format === undefined) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
956 // No configuration for the date format, use the DICOM tag as such
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
957 return time;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
958 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
959 else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
960 var timeRegexHMS = /([0-9]{2})([0-9]{2})([0-9]{2})/;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
961 var timeRegexHMSms = /([0-9]{2})([0-9]{2})([0-9]{2}).([0-9]*)/
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
962 var m = time.match(timeRegexHMSms);
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
963 if (m) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
964 format = format.replace(/hh/g, m[1]).replace(/mm/g, m[2]).replace(/ss/g, m[3]);
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
965 if (format.indexOf('f') != -1) { // format expects ms
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
966 return format.replace(/f/g, m[4])
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
967 } else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
968 return format;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
969 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
970 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
971 var m = time.match(timeRegexHMS);
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
972 if (m) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
973 format = format.replace(/hh/g, m[1]).replace(/mm/g, m[2]).replace(/ss/g, m[3]);
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
974 if (format.indexOf('f') != -1) { // format expects ms but we could not capture one
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
975 return format.replace(/.f/g, '')
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
976 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
977 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
978
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
979 return time;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
980 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
981 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
982 },
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
983
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
984 DownloadJpeg: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
985 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
986 var canvas = document.getElementById(this.GetActiveCanvas());
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
987 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
988 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
989
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
990 SetCombinedToolActions: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
991 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
992 var left = stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
993 var middle = stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
994 var right = stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
995
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
996 var behaviour = this.globalConfiguration['CombinedToolBehaviour'];
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
997 if (behaviour !== undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
998 left = ConvertMouseAction(behaviour['LeftMouseButton'], left);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
999 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1000 right = ConvertMouseAction(behaviour['RightMouseButton'], right);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1001 }
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1002
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1003 this.SetMouseButtonActions(MOUSE_TOOL_COMBINED, left, middle, right);
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1004 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1005
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1006 CheckIsDownloadComplete: function()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1007 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1008 if (this.creatingArchive &&
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1009 this.archiveJob.length > 0) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1010
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1011 var that = this;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1012 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
1013 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1014 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
1015 var state = response.data['State'];
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1016 if (state == 'Success') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1017 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
1018 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
1019
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
1020 /**
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
1021 * 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
1022 * (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
1023 * 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
1024 * 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
1025 **/
65c03d33c345 use "window.location" instead of "window.open()" to download archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1714
diff changeset
1026 // 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
1027 window.location = uri;
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1028 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1029 else if (state == 'Running') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1030 setTimeout(that.CheckIsDownloadComplete, 1000);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1031 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1032 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1033 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
1034 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1035 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1036 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1037 .catch(function(error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1038 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
1039 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1040 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1041 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1042 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1043
1842
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1044 DownloadStudy: function(studyInstanceUid, event)
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1045 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1046 console.log('Creating archive for study: ' + studyInstanceUid);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1047
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1048 var that = this;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1049 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
1050 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1051 if (response.data.length != 1) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1052 throw('');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1053 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1054 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1055 var orthancId = response.data[0]['ID'];
1843
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1056
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1057 var uri = that.globalConfiguration.OrthancApiRoot + '/studies/' + orthancId;
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1058 if (that.globalConfiguration.DownloadDicomDir === true) {
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1059 uri = uri + '/media';
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1060 } else {
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1061 uri = uri + '/archive';
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1062 }
1842
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1063
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1064 if (that.orthancSystem.ApiVersion >= 13) {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1065 // ZIP streaming is available (this is Orthanc >=
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1066 // 1.9.4): Simply give the hand to Orthanc
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1067 event.preventDefault();
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1068 window.location.href = uri;
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1069
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1070 } else {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1071 // ZIP streaming is not available: Create a job to create the archive
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1072 axios.post(uri, {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1073 'Asynchronous' : true
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1074 })
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1075 .then(function(response) {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1076 that.creatingArchive = true;
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1077 that.archiveJob = response.data.ID;
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1078 setTimeout(that.CheckIsDownloadComplete, 1000);
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1079 });
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1080 }
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1081 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1082 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1083 .catch(function (error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1084 alert('Cannot find the study in Orthanc');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1085 });
1842
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1086
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1087 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1088 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090 mounted: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091 this.SetViewportLayout('1x1');
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1092
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1093 if (localStorage.settingNotDiagnostic) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1094 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1095 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1096
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1097 if (localStorage.settingSoftwareRendering) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1098 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1099 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1100
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1101 this.modalNotDiagnostic = this.settingNotDiagnostic;
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1102
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1103 var that = this;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1104
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1105 window.addEventListener('VirtualSeriesThumbnailLoaded', function(args) {
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1106 that.$set(that.virtualSeriesThumbnails, args.detail.virtualSeriesId, args.detail.thumbnail);
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1107 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1108
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1109 window.addEventListener('ThumbnailLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1110 //var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1111 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1112 that.UpdateSeriesThumbnail(seriesInstanceUid);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1113 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1114
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1115 window.addEventListener('MetadataLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1116 var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1117 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1118 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1119 });
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1120
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1121 window.addEventListener('StoneAnnotationAdded', function() {
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1122 // Ignore
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1123 });
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1124
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1125 window.addEventListener('StoneAnnotationRemoved', function() {
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1126 // Ignore
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1127 });
1495
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 });
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
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1133 window.addEventListener('StoneInitialized', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1134 stone.Setup(Module);
1713
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1135 stone.SetDicomWebRoot(app.globalConfiguration.DicomWebRoot,
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1136 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
1137 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
1138
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1139 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
1140 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
1141 }
1761
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1142
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1143 // 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
1144 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
1145 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
1146 {
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1147 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
1148 }
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1149
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
1150 console.warn('Stone properly initialized');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151
1827
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
1152 app.stoneWebViewerVersion = stone.GetStoneWebViewerVersion();
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
1153 app.emscriptenVersion = stone.GetEmscriptenVersion();
1824
a56bf4c534ef display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1820
diff changeset
1154
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1155 app.SetCombinedToolActions();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1156
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1157 var selectedStudies = getParameterFromUrl('selectedStudies');
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1158 var patient = getParameterFromUrl('patient');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1159 var study = getParameterFromUrl('study');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1160 var series = getParameterFromUrl('series');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1162 if (selectedStudies !== undefined) {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1163 app.selectedStudies = selectedStudies.split(',');
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1164 } else {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1165 app.selectedStudies = [];
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1166 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1167
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1168 if (study !== undefined &&
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1169 series !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1170 console.warn('Loading series: ' + series + ' from study: ' + study);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1171 stone.FetchSeries(study, series);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1172 app.leftMode = 'full';
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1173 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1174 else {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1175 var empty = true;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1176
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1177 if (study !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1178 var studies = study.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1179 if (studies.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1180 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1181 for (var i = 0; i < studies.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1182 console.warn('Loading study: ' + studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1183 stone.FetchStudy(studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1184 }
1691
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
1185 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1186 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1187
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1188 if (patient !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1189 var patients = patient.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1190 if (patients.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1191 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1192 for (var i = 0; i < patients.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1193 console.warn('Loading patient: ' + patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1194 stone.FetchPatient(patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1195 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1196 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1197 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1198
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1199 if (empty) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1200 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
1201 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1203 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 window.addEventListener('ResourcesLoaded', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1207 console.log('resources loaded');
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 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 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
1211 stone.LoadStudyTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 studies.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 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
1217 stone.LoadSeriesTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218 series.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1219 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 app.SetResources(studies, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1223 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
1224 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
1225 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
1226 app.UpdateSeriesThumbnail(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
1227 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232 window.addEventListener('StoneException', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233 console.error('Exception catched in Stone');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1235
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1238 function ParseJsonWithComments(json)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1239 {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1240 if (typeof(json) == 'string') {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1241 // https://stackoverflow.com/a/62945875/881731
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1242 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
1243 (m, g) => g ? "" : m));
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1244 } else {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1245 return json;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1246 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1247 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250 $(document).ready(function() {
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1251 RefreshTooltips();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1252
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1253 //app.modalWarning = true;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1255 axios.get(CONFIGURATION_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1256 .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
1257 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
1258
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1259 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
1260 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
1261 app.globalConfiguration = {};
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1262 }
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
1263
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1264 // 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
1265
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1266 /*
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1267 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1268 script.src = WASM_SOURCE;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1269 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1270 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1271 */
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1273 // 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
1274 // explicitly report errors)
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1276 axios.get(WASM_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1277 .then(function (response) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1278 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1279 script.innerHTML = response.data;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1280 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1281 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1282 })
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1283 .catch(function (error) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1284 alert('Cannot load the WebAssembly framework');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1285 });
1842
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1286
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1287 if (app.globalConfiguration.OrthancApiRoot) {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1288 axios.get(app.globalConfiguration.OrthancApiRoot + '/system')
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1289 .then(function (response) {
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1290 app.orthancSystem = response.data;
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1291 });
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1292 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293 })
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294 .catch(function (error) {
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1295 alert('Cannot load the configuration file');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1296 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1297 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 // "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
1301 // studies: https://stackoverflow.com/questions/26639346
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1302 $('.dropdown-menu').click(function(e) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 e.stopPropagation();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307 // 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
1308 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
1309
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1310
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1311 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
1312 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
1313 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
1314 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
1315
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1316 if (expectedOrigin === undefined) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1317 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
1318 '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
1319 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1320 else if (expectedOrigin != '*' &&
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1321 e.origin !== expectedOrigin) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1322 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
1323 '", 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
1324 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1325 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
1326 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
1327 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
1328 clear = e.data.clear;
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1329 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1330
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1331 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
1332 }
1611
787db80a5a1b new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1603
diff changeset
1333 }
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1334 else {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1335 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
1336 }
1707
ee2b5990dfff remove annoying alert box in the server demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1706
diff changeset
1337 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1338 });