annotate Applications/StoneWebViewer/WebApplication/app.js @ 2060:86e0e92a2e0d deep-learning

added OpenGLTextureArray and OpenGLFramebuffer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 May 2023 16:15:50 +0200
parents 0d814292a17e
children 82dbe2729b69
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
1871
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * 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
12 *
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * 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
15 * 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
16 * Affero General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1593
diff changeset
17 *
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * 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
19 * 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
20 **/
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
23 var CONFIGURATION_SOURCE = 'configuration.json';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
24 var WASM_SOURCE = 'StoneWebViewer.js';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
25
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 var COLORS = [ 'blue', 'red', 'green', 'yellow', 'violet' ];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 var SERIES_INSTANCE_UID = '0020,000e';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 var STUDY_INSTANCE_UID = '0020,000d';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 var STUDY_DESCRIPTION = '0008,1030';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 var STUDY_DATE = '0008,0020';
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
31 var PATIENT_ID = '0010,0020';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
32 var PATIENT_NAME = '0010,0010';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
33 var SERIES_NUMBER = '0020,0011';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
34 var SERIES_DESCRIPTION = '0008,103e';
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
35 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
36 var PATIENT_BIRTH_DATE = '0010,0030';
2015
d0e68dd335dd patient sex is displayed in the top-left information panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2014
diff changeset
37 var PATIENT_SEX = '0010,0040';
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
39 // 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
40 var pendingSeriesPdf_ = {};
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
41
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
42 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
43 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
44 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
45 var MOUSE_TOOL_CROSSHAIR = 4;
1998
1fa3f484008e added arrows to AnnotationsSceneLayer::Segment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1996
diff changeset
46 var MOUSE_TOOL_CREATE_LENGTH = 5;
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
47 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
48 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
49 var MOUSE_TOOL_REMOVE_MEASURE = 8;
1982
ba45e1b0812a preparing interfaces for rectangle probe, ellipse probe and text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
50 var MOUSE_TOOL_CREATE_PIXEL_PROBE = 9; // New in 2.4
ba45e1b0812a preparing interfaces for rectangle probe, ellipse probe and text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
51 var MOUSE_TOOL_CREATE_ELLIPSE_PROBE = 10; // New in 2.4
ba45e1b0812a preparing interfaces for rectangle probe, ellipse probe and text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
52 var MOUSE_TOOL_CREATE_RECTANGLE_PROBE = 11; // New in 2.4
ba45e1b0812a preparing interfaces for rectangle probe, ellipse probe and text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1980
diff changeset
53 var MOUSE_TOOL_CREATE_TEXT_ANNOTATION = 12; // New in 2.4
1993
317a53d4fdc6 added magnifying glass
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1989
diff changeset
54 var MOUSE_TOOL_MAGNIFYING_GLASS = 13; // New in 2.4
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
55
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
56 var hasAuthorizationToken = false;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
57 var axiosHeaders = {};
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
58
1495
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 function getParameterFromUrl(key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 var url = window.location.search.substring(1);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 var args = url.split('&');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 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
64 var arg = args[i].split('=');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 if (arg[0] == key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 return arg[1];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
72 // https://stackoverflow.com/a/21797381/881731
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
73 function Base64ToArrayBuffer(base64) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
74 var binary_string = window.atob(base64);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
75 var len = binary_string.length;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
76 var bytes = new Uint8Array(len);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
77 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
78 bytes[i] = binary_string.charCodeAt(i);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
79 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
80 return bytes.buffer;
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
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
83
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
84 function SaveDataUriScheme(filename, dataUriScheme) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
85 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
86 var base64 = dataUriScheme.split(',')[1];
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 var blob = new Blob([ Base64ToArrayBuffer(base64) ], {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
89 type: mimeType
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
90 });
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
91
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
92 var link = document.createElement('a');
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
93 link.href = window.URL.createObjectURL(blob);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
94 link.download = filename;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
95 link.click();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
96 };
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
97
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
98
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
99 // 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
100 // possible values
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
101 function ConvertMouseAction(config, defaultAction)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
102 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
103 if (config === undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
104 return defaultAction;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
105 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
106 if (config == "Windowing") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
107 return stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
108 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
109 else if (config == "Zoom") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
110 return stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
111 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
112 else if (config == "Pan") {
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 else if (config == "Rotate") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
116 return stone.WebViewerAction.ROTATE;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
117 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
118 else if (config == "Crosshair") {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
119 return stone.WebViewerAction.CROSSHAIR;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
120 }
1993
317a53d4fdc6 added magnifying glass
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1989
diff changeset
121 else if (config == "MagnifyingGlass") {
317a53d4fdc6 added magnifying glass
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1989
diff changeset
122 return stone.WebViewerAction.MAGNIFYING_GLASS;
317a53d4fdc6 added magnifying glass
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1989
diff changeset
123 }
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
124 else {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
125 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
126 return stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
127 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
128 }
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
129
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
130
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
131 function LookupIndexOfResource(array, tag, value) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
132 for (var i = 0; i < array.length; i++) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
133 if (array[i].tags[tag] == value) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
134 return i;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
135 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
136 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
137
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
138 return -1;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
139 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
140
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
141
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
142 /**
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
143 * 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
144 * 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
145 * tooltips (e.g. after loading studies).
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
146 **/
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
147 function RefreshTooltips()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
148 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
149 $('[data-toggle="tooltip"]').tooltip({
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
150 placement: 'bottom',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
151 container: 'body',
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
152 trigger: 'hover'
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
153 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
154 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
155
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
156
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
157 function TriggerDownloadFromUri(uri, filename, mime)
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
158 {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
159 if (hasAuthorizationToken) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
160 axios.get(uri, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
161 headers: axiosHeaders,
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
162 responseType: 'arraybuffer'
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
163 })
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
164 .then(function(response) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
165 const blob = new Blob([ response.data ], { type: mime });
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
166 const url = URL.createObjectURL(blob);
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
167
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
168 //window.open(url, '_blank');
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
169
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
170 // https://stackoverflow.com/a/19328891
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
171 var a = document.createElement("a");
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
172 document.body.appendChild(a);
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
173 a.style = "display: none";
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
174 a.href = url;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
175 a.download = filename;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
176 a.click();
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
177 window.URL.revokeObjectURL(url);
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
178 });
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
179
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
180 } else {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
181 // This version was used in Stone Web viewer <= 2.4, but doesn't
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
182 // work with authorization headers
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
183
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
184 /**
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
185 * The use of "window.open()" below might be blocked (depending on
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
186 * the browser criteria to block popup). As a consequence, we
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
187 * prefer to set "window.location".
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
188 * https://www.nngroup.com/articles/the-top-ten-web-design-mistakes-of-1999/
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
189 **/
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
190 // window.open(uri, '_blank');
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
191 window.location.href = uri;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
192 }
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
193 }
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
194
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
195
2014
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
196 /**
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
197 * The "mousemove" and "mouseup" events were added in Stone Web viewer
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
198 * 2.5 to allow click/drag on the vertical scrollbar.
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
199 **/
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
200 var activeVerticalScrollbarViewport = null;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
201 var activeVerticalScrollbarTarget = null;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
202
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
203 window.addEventListener('mousemove', function(event) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
204 if (activeVerticalScrollbarViewport !== null) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
205 activeVerticalScrollbarViewport.ClickVerticalScrollbar(event, activeVerticalScrollbarTarget);
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
206 event.preventDefault();
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
207 }
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
208 });
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
209
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
210 window.addEventListener('mouseup', function(event) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
211 activeVerticalScrollbarViewport = null;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
212 });
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
213
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
214
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 Vue.component('viewport', {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
216 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
217 'showInfo', 'globalConfiguration' ],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 template: '#viewport-template',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 data: function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 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
222 status: 'waiting',
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
223 currentFrame: 0,
1968
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
224 currentFrameFromUser: 0,
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
225 numberOfFrames: 0,
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
226 quality: '',
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
227 cineControls: false,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
228 cineIncrement: 0,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
229 cineFramesPerSecond: 30,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
230 cineTimeoutId: null,
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
231 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
232 videoUri: '',
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
233 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
234 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
235 instanceNumber: 0,
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
236 contentDate: '',
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
237 contentTime: '',
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
240 watch: {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
241 currentFrame: function(newVal, oldVal) {
1968
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
242 this.currentFrameFromUser = newVal + 1;
1967
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
243 if (this.cineLoadingFrame) {
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
244 /**
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
245 * The "FrameUpdated" event has been received, which indicates
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
246 * that the schedule frame has been displayed: The cine loop can
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
247 * proceed to the next frame (check out "CineCallback()").
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
248 **/
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
249 this.cineLoadingFrame = false;
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
250 } else {
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
251 stone.SetFrame(this.canvasId, newVal);
b180233143ae Added vertical slider showing position of the current frame inside the series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1959
diff changeset
252 }
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
253 },
1968
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
254 currentFrameFromUser: function(newVal, oldVal) {
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
255 if (parseInt(newVal, 10) !== NaN &&
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
256 newVal >= 1 &&
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
257 newVal <= this.numberOfFrames) {
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
258 this.currentFrame = this.currentFrameFromUser - 1;
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
259 }
ed5a0b9183dc The text field with the instance number is editable to go to a specific instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1967
diff changeset
260 },
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
261 content: function(newVal, oldVal) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 this.status = 'loading';
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
263 this.cineControls = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
264 this.cineMode = '';
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
265 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
266 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
267 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
268 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
269 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
270 this.contentDate = '';
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
271 this.contentTime = ''
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
272
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
273 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
274 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
275 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
276 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
278 var studyInstanceUid = newVal.series.tags[STUDY_INSTANCE_UID];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
279 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
280 stone.SpeedUpFetchSeriesMetadata(studyInstanceUid, seriesInstanceUid);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
281
1920
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
282 if (newVal.series.type == stone.ThumbnailType.IMAGE ||
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
283 newVal.series.type == stone.ThumbnailType.NO_PREVIEW) {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
284 if (newVal.series.complete) {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
285 this.status = 'ready';
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
286
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
287 var that = this;
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
288 Vue.nextTick(function() {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
289 if (newVal.virtualSeriesId !== undefined &&
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
290 newVal.virtualSeriesId.length > 0) {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
291 stone.LoadVirtualSeriesInViewport(that.canvasId, newVal.virtualSeriesId);
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
292 }
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
293 else {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
294 stone.LoadSeriesInViewport(that.canvasId, seriesInstanceUid);
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
295 }
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
296 });
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
297 } else {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
298 console.warn('Series is incomplete: ' + seriesInstanceUid);
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
299 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
301 else if (newVal.series.type == stone.ThumbnailType.PDF) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
302 if (newVal.series.complete) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
303 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
304 * Series is complete <=> One already knows about the
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
305 * SOPInstanceUIDs that are available in this series. As a
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
306 * consequence,
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
307 * "OrthancStone::SeriesMetadataLoader::Accessor" will not
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
308 * be empty in "ResourcesLoader::FetchPdf()" in C++ code.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
309 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
310 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
311 } else {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
312 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
313 * The SOPInstanceUIDs in this series are not known
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
314 * yet. Schedule an "stone.FetchPdf()" one the series
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
315 * metadata is available.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
316 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
317 pendingSeriesPdf_[seriesInstanceUid] = true;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
318 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
319 }
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
320 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
321 this.status = 'video';
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
322 this.videoUri = '';
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
323 if (this.globalConfiguration.OrthancApiRoot) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
324 var that = this;
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
325 axios.post(that.globalConfiguration.OrthancApiRoot + '/tools/find', {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
326 Level : 'Instance',
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
327 Query : {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
328 StudyInstanceUID: studyInstanceUid
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
329 }
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
330 }, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
331 headers: axiosHeaders
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
332 })
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
333 .then(function(response) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
334 if (response.data.length != 1) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
335 throw('');
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
336 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
337 else {
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
338 var uri = that.globalConfiguration.OrthancApiRoot + '/instances/' + response.data[0] + '/frames/0/raw';
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
339
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
340 if (hasAuthorizationToken) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
341 axios.get(uri, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
342 headers: axiosHeaders,
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
343 responseType: 'arraybuffer'
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
344 })
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
345 .then(function(response) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
346 const blob = new Blob([ response.data ]);
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
347 that.videoUri = URL.createObjectURL(blob);
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
348 });
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
349 } else {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
350 that.videoUri = uri;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
351 }
1710
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
352 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
353 })
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
354 .catch(function(error) {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
355 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
356 });
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
357 }
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
358 else {
673c163e1b3e playing videos if Orthanc is not available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1709
diff changeset
359 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
360 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 }
1920
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
362 else {
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
363 console.error('Unable to handle this series: ' + seriesInstanceUid);
05f0327d26c8 added logs in app.js
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
364 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 },
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
367 mounted: function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
368 var that = this;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
369
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
370 window.addEventListener('FrameUpdated', function(args) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
371 if (args.detail.canvasId == that.canvasId) {
1949
d3ae6858e77b more consistent handling of numberOfFrames
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1947
diff changeset
372 that.currentFrame = args.detail.currentFrame;
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
373 that.numberOfFrames = args.detail.numberOfFrames;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
374 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
375 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
376 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
377 that.contentTime = args.detail.contentTime;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
378 }
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
379 });
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
380
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
381 window.addEventListener('SeriesDetailsReady', function(args) {
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
382 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
383 that.cineFramesPerSecond = stone.GetCineRate(that.canvasId);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
384 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
385 });
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
386
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
387 window.addEventListener('PdfLoaded', function(args) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
388 var studyInstanceUid = args.detail.studyInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
389 var seriesInstanceUid = args.detail.seriesInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
390 var pdfPointer = args.detail.pdfPointer;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
391 var pdfSize = args.detail.pdfSize;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
392
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
393 if ('tags' in that.content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
394 that.content.series.tags[STUDY_INSTANCE_UID] == studyInstanceUid &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
395 that.content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
396
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
397 that.status = 'pdf';
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
398 var pdf = new Uint8Array(HEAPU8.subarray(pdfPointer, pdfPointer + pdfSize));
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
399
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
400 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
401 * 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
402 * 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
403 * 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
404 * populated after the component has been rendered", so we
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
405 * wait for the next rendering.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
406 * 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
407 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
408 Vue.nextTick(function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
409 that.$refs.pdfViewer.LoadPdf(pdf);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
410 });
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
411 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
412 });
1720
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
413
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
414 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
415 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
416 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
417 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
418 }
b8d19f53aaca display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1718
diff changeset
419 });
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
420
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
421 window.addEventListener('KeyCineSwitch', function(args) {
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
422 if (that.active) {
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
423 that.KeyCineSwitch();
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
424 }
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
425 });
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
426 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 methods: {
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
428 DragDrop: function(event) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 event.preventDefault();
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
430
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
431 // The "parseInt()" is because of Microsoft Edge Legacy (*)
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
432 this.$emit('updated-series', {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
433 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
434 virtualSeriesId: event.dataTransfer.getData('virtualSeriesId')
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
435 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 MakeActive: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 this.$emit('selected-viewport');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
440 DecrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
441 return stone.DecrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
442 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
443 IncrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
444 return stone.IncrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
445 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
446 CinePlay: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
447 this.cineControls = true;
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
448 this.cineIncrement = -1;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
449 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
450 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
451 CinePause: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
452 if (this.cineIncrement == 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
453 // 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
454 this.cineControls = !this.cineControls;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
455 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
456 this.cineIncrement = 0;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
457 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
458 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
459 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
460 CineBackward: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
461 this.cineControls = true;
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
462 this.cineIncrement = 1;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
463 this.UpdateCine();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 },
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
465 KeyCineSwitch: function() {
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
466 if (this.cineIncrement != 0) {
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
467 this.CinePause();
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
468 } else {
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
469 this.CinePlay();
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
470 }
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
471 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
472 UpdateCine: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
473 // Cancel the previous cine loop, if any
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
474 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
475 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
476 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
477 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
478
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
479 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
480
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
481 if (this.cineIncrement != 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
482 this.CineCallback();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
483 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
484 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
485 CineCallback: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
486 var reschedule;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
487
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
488 if (this.cineLoadingFrame) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
489 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
490 * 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
491 * "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
492 * "FrameUpdated" event). Otherwise, the background loading
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
493 * 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
494 * advancement of the current frame, which freezes the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
495 * display.
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
496 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
497 reschedule = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
498 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
499 this.cineLoadingFrame = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
500
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
501 if (this.cineIncrement == 1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
502 reschedule = this.DecrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
503 } else if (this.cineIncrement == -1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
504 reschedule = this.IncrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
505 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
506 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
507 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
508 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
509
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
510 if (reschedule) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
511 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
512 }
2013
dbafd535136e refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2010
diff changeset
513 },
2014
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
514 ClickVerticalScrollbar: function(event, target) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
515 if (target == undefined) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
516 target = event.currentTarget;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
517 activeVerticalScrollbarViewport = this;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
518 activeVerticalScrollbarTarget = target;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
519 }
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
520
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
521 var offset = target.getClientRects()[0];
2013
dbafd535136e refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2010
diff changeset
522 var y = event.clientY - offset.top;
2014
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
523 var height = target.offsetHeight;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
524 var frame = Math.min(this.numberOfFrames - 1, Math.floor(y * this.numberOfFrames / (height - 1)));
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
525
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
526 if (frame >= 0 &&
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
527 frame < this.numberOfFrames) {
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
528 this.currentFrame = frame;
a7b5cb068fb8 click-drag is available on the vertical slider
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2013
diff changeset
529 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 }
1651
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1616
diff changeset
532 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
533
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 var app = new Vue({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 el: '#wv',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 data: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 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
540 ready: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 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
542 leftVisible: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543 viewportLayoutButtonsVisible: false,
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
544 mouseActionsVisible: false,
2010
25d269c7b753 grouping annotations into one submenu for narrow screens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2001
diff changeset
545 annotationActionsVisible: false,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 activeViewport: 0,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 showInfo: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 showReferenceLines: true,
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
549 synchronizedBrowsing: false,
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
550 globalConfiguration: {},
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
551 creatingArchive: false,
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
552 archiveJob: '',
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
553 mouseTool: 0,
1843
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
554 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
555 stoneWebViewerVersion: '...',
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
556 emscriptenVersion: '...',
2017
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
557 isFirstSeries: true,
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
558
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
559 modalWarning: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
560 modalNotDiagnostic: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
561 modalPreferences: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
562
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
563 // 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
564 settingNotDiagnostic: true,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
565 settingSoftwareRendering: false,
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
566 settingLinearInterpolation: true,
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
567
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
568 layoutCountX: 1,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
569 layoutCountY: 1,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 viewport1Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 viewport1Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 viewport1Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 viewport1Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 viewport1Visible: true,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
576 viewport1Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 viewport2Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 viewport2Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 viewport2Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 viewport2Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 viewport2Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
583 viewport2Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 viewport3Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586 viewport3Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 viewport3Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 viewport3Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589 viewport3Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
590 viewport3Content: { series: {} },
1495
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 viewport4Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 viewport4Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 viewport4Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 viewport4Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 viewport4Visible: false,
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
597 viewport4Content: { series: {} },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
599 showWindowing: false,
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
600 windowingPresets: [],
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
601
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
602 selectedStudies: [],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 series: [],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 studies: [],
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
605 seriesIndex: {}, // Maps "SeriesInstanceUID" to "index in this.series"
1950
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
606 virtualSeriesThumbnails: {},
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
607
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
608 deepLearningReady: false,
2029
0cb8796c2a9b measure time for deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
609 deepLearningProgress: 0, // Floating-point number in the range [0..1]
0cb8796c2a9b measure time for deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
610 deepLearningStartTime: null
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 computed: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 getSelectedStudies() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 var s = '';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 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
617 if (this.studies[i].selected) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 if (s.length > 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 s += ', ';
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
620 s += this.studies[i].tags[STUDY_DESCRIPTION];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
621
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
622 var date = this.studies[i].tags[STUDY_DATE];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
623 if (date.length > 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
624 s += ' [' + this.FormatDate(date) + ']';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
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 if (s.length == 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 return '...';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 else
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 watch: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 leftVisible: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 showReferenceLines: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 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
640 },
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
641 synchronizedBrowsing: function(newVal, oldVal) {
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
642 stone.SetSynchronizedBrowsingEnabled(newVal ? 1 : 0);
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
643 },
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
644 settingNotDiagnostic: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
645 localStorage.settingNotDiagnostic = (newVal ? '1' : '0');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
646 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
647 settingSoftwareRendering: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
648 localStorage.settingSoftwareRendering = (newVal ? '1' : '0');
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
649 },
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
650 settingLinearInterpolation: function(newVal, oldVal) {
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
651 localStorage.settingLinearInterpolation = (newVal ? '1' : '0');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 methods: {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
655 FitContent: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 // 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
657 if (typeof stone._AllViewportsUpdateSize !== 'undefined') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658 this.$nextTick(function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659 stone.AllViewportsUpdateSize(true /* fit content */);
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 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 },
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
663
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
664 GetActiveViewportSeriesTags: function() {
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
665 if (this.activeViewport == 1) {
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
666 return this.viewport1Content.series.tags;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
667 }
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
668 else if (this.activeViewport == 2) {
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
669 return this.viewport2Content.series.tags;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
670 }
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
671 else if (this.activeViewport == 3) {
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
672 return this.viewport3Content.series.tags;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
673 }
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
674 else if (this.activeViewport == 4) {
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
675 return this.viewport4Content.series.tags;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
676 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
677 else {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
678 return null;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
679 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
680 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
682 GetActiveSeriesInstanceUid: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 var s = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
685 if ('tags' in this.viewport1Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
686 s.push(this.viewport1Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
687
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
688 if ('tags' in this.viewport2Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
689 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
690
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
691 if ('tags' in this.viewport3Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
692 s.push(this.viewport3Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
693
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
694 if ('tags' in this.viewport4Content.series)
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
695 s.push(this.viewport4Content.series.tags[SERIES_INSTANCE_UID]);
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
696
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
697 return s;
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
698 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
700 GetActiveVirtualSeries: function() {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
701 var s = [];
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
702
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
703 if ('virtualSeriesId' in this.viewport1Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
704 s.push(this.viewport1Content.virtualSeriesId);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
706 if ('virtualSeriesId' in this.viewport2Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
707 s.push(this.viewport2Content.virtualSeriesId);
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
708
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
709 if ('virtualSeriesId' in this.viewport3Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
710 s.push(this.viewport3Content.virtualSeriesId);
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
711
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
712 if ('virtualSeriesId' in this.viewport4Content)
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
713 s.push(this.viewport4Content.virtualSeriesId);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
718 GetActiveCanvas: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 if (this.activeViewport == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 else if (this.activeViewport == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 return 'canvas2';
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 (this.activeViewport == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
726 return 'canvas3';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 else if (this.activeViewport == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 return 'canvas4';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 return 'canvas1';
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 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735
1947
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
736 SetResources: function(sourceStudies, sourceSeries) {
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
737 // Here one can fix input studies/series for missing DICOM tags
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
738 // that are needed for the Stone Web viewer (e.g. "hand.dcm")
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
739 for (var i = 0; i < sourceStudies.length; i++) {
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
740 if (!(STUDY_DATE in sourceStudies[i])) {
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
741 sourceStudies[i][STUDY_DATE] = '';
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
742 }
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
743 }
31fd7aba48ca Support of DICOM images without the Study Date (0008,0020) tag
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1920
diff changeset
744
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 var indexStudies = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 var posColor = 0;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749
1861
9290d2916150 SeriesList: order series by SeriesNumber + hide non displayable series
Alain Mazy <am@osimis.io>
parents: 1859
diff changeset
750 // order series by SeriesNumber
9290d2916150 SeriesList: order series by SeriesNumber + hide non displayable series
Alain Mazy <am@osimis.io>
parents: 1859
diff changeset
751 sourceSeries.sort((a, b) => {return a[SERIES_NUMBER] - b[SERIES_NUMBER];})
9290d2916150 SeriesList: order series by SeriesNumber + hide non displayable series
Alain Mazy <am@osimis.io>
parents: 1859
diff changeset
752
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 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
754 var studyInstanceUid = sourceStudies[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 if (studyInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 console.error('Twice the same study: ' + studyInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 } else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 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
760
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
761 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
762 this.selectedStudies.includes(studyInstanceUid));
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 studies.push({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 'studyInstanceUid' : studyInstanceUid,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 'series' : [ ],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 'color' : COLORS[posColor],
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
768 'selected' : isSelected,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 'tags' : sourceStudies[i]
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 posColor = (posColor + 1) % COLORS.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 }
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 series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 var seriesIndex = {};
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 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
781 var studyInstanceUid = sourceSeries[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 var seriesInstanceUid = sourceSeries[i][SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 if (studyInstanceUid !== undefined &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 seriesInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 seriesIndex[seriesInstanceUid] = series.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 var study = studies[indexStudies[studyInstanceUid]];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 study.series.push(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 series.push({
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
790 'numberOfFrames' : 0,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 'complete' : false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 'type' : stone.ThumbnailType.LOADING,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 'color': study.color,
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
794 'tags': sourceSeries[i],
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
795 'virtualSeries': null
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801 this.studies = studies;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 this.series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 this.seriesIndex = seriesIndex;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 this.ready = true;
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
805
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
806 Vue.nextTick(function() {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
807 RefreshTooltips();
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
808 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 SeriesDragStart: function(event, seriesIndex) {
2050
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
812 if (this.series[seriesIndex].numberOfFrames > 0) { // prevent dragging before the series metadata have been loaded
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
813 // It is necessary to use ".toString()" for Microsoft Edge Legacy (*)
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
814 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
815 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816 },
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
817
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
818 VirtualSeriesDragStart: function(event, seriesIndex, virtualSeriesId) {
2050
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
819 if (this.series[seriesIndex].numberOfFrames > 0) { // prevent dragging before the series metadata have been loaded
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
820 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
821 event.dataTransfer.setData('virtualSeriesId', virtualSeriesId.toString());
b2738d7a388d Prevent dragging series before they are ready
Alain Mazy <am@osimis.io>
parents: 2030
diff changeset
822 }
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
823 },
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
824
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
825 SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
826 if (seriesInstanceUid in this.seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
827 this.SetViewportSeries(viewportIndex, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
828 seriesIndex: this.seriesIndex[seriesInstanceUid]
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
829 });
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
830 }
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
831 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
832
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
833 SetViewportVirtualSeries: function(viewportIndex, seriesInstanceUid, virtualSeriesId) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
834 if (seriesInstanceUid in this.seriesIndex) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
835 this.SetViewportSeries(viewportIndex, {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
836 seriesIndex: this.seriesIndex[seriesInstanceUid],
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
837 virtualSeriesId: virtualSeriesId
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
838 });
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
839 }
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
840 },
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
841
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
842 SetViewportSeries: function(viewportIndex, info) {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
843 var series = this.series[info.seriesIndex];
1495
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 if (viewportIndex == 1) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
846 this.viewport1Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
847 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
848 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
849 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 else if (viewportIndex == 2) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
852 this.viewport2Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
853 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
854 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
855 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 else if (viewportIndex == 3) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
858 this.viewport3Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
859 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
860 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
861 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863 else if (viewportIndex == 4) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
864 this.viewport4Content = {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
865 series: series,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
866 virtualSeriesId: info.virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
867 };
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868 }
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
869
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
870 // Give the focus to this viewport (new in Stone Web viewer 2.5)
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
871 this.activeViewport = viewportIndex;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874 ClickSeries: function(seriesIndex) {
1704
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
875 this.SetViewportSeries(this.activeViewport, {
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
876 seriesIndex: seriesIndex
902d13889ae4 LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1703
diff changeset
877 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
880 ClickVirtualSeries: function(seriesIndex, virtualSeriesId) {
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
881 this.SetViewportSeries(this.activeViewport, {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
882 seriesIndex: seriesIndex,
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
883 virtualSeriesId: virtualSeriesId
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
884 });
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
885 },
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
886
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 HideViewport: function(index) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889 this.viewport1Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
890 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 this.viewport2Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 this.viewport3Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
898 this.viewport4Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 ShowViewport: function(index, left, top, width, height) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
903 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 this.viewport1Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 this.viewport1Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 this.viewport1Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 this.viewport1Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 this.viewport1Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 this.viewport2Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 this.viewport2Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913 this.viewport2Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 this.viewport2Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 this.viewport2Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 this.viewport3Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 this.viewport3Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 this.viewport3Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 this.viewport3Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922 this.viewport3Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 this.viewport4Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 this.viewport4Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 this.viewport4Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 this.viewport4Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 this.viewport4Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 SetViewportLayout: function(layout) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
934 this.viewportLayoutButtonsVisible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 if (layout == '1x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 this.ShowViewport(1, '0%', '0%', '100%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 this.HideViewport(2);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
940 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
941 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 else if (layout == '2x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 this.ShowViewport(1, '0%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 this.ShowViewport(2, '50%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 this.ShowViewport(3, '0%', '50%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 this.ShowViewport(4, '50%', '50%', '50%', '50%');
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
948 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
949 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 else if (layout == '2x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 this.ShowViewport(1, '0%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 this.ShowViewport(2, '50%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
956 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
957 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 else if (layout == '1x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 this.ShowViewport(1, '0%', '0%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 this.ShowViewport(2, '0%', '50%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
964 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
965 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 UpdateSeriesThumbnail: function(seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976 var type = stone.LoadSeriesThumbnail(seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977 series.type = type;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979 if (type == stone.ThumbnailType.IMAGE) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980 series.thumbnail = stone.GetStringBuffer();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
982
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
983 // 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
984 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
988 UpdateIsSeriesComplete: function(studyInstanceUid, seriesInstanceUid) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
989 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
991 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
993 var oldComplete = series.complete;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
994
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 series.complete = stone.IsSeriesComplete(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
996
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
997 if (!oldComplete &&
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
998 series.complete)
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
999 {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1000 series.numberOfFrames = stone.GetSeriesNumberOfFrames(seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1001
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1002 if (seriesInstanceUid in pendingSeriesPdf_) {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1003 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1004 delete pendingSeriesPdf_[seriesInstanceUid];
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
1005 }
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1006
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1007 if (stone.LookupVirtualSeries(seriesInstanceUid)) {
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1008 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
1009 }
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
1010 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1011
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012 // 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
1013 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1015 if ('tags' in this.viewport1Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1016 this.viewport1Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1017 this.$set(this.viewport1Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1019
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1020 if ('tags' in this.viewport2Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1021 this.viewport2Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1022 this.$set(this.viewport2Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1025 if ('tags' in this.viewport3Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1026 this.viewport3Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1027 this.$set(this.viewport3Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029
1705
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1030 if ('tags' in this.viewport4Content.series &&
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1031 this.viewport4Content.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
3d62634d442f multiple multiframe is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1704
diff changeset
1032 this.$set(this.viewport4Content.series, series);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1035 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1036
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1037 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
1038 this.showWindowing = false;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 stone.SetWindowing(canvas, center, width);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044
2030
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1045 StretchWindowing: function(center, width) {
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1046 this.showWindowing = false;
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1047 var canvas = this.GetActiveCanvas();
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1048 if (canvas != '') {
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1049 stone.StretchWindowing(canvas);
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1050 }
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1051 },
f36de3ba43c8 added button "Stretch to whole range" in the "Change windowing" menu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2023
diff changeset
1052
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1053 InvertContrast: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1054 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 stone.InvertContrast(canvas);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057 }
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1058 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1059
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1060 FlipX: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1061 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1062 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1063 stone.FlipX(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1064 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1065 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1066
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1067 FlipY: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1068 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1069 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1070 stone.FlipY(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1071 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1072 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
1073
1989
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1074 RotateLeft: function() {
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1075 var canvas = this.GetActiveCanvas();
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1076 if (canvas != '') {
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1077 stone.RotateLeft(canvas);
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1078 }
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1079 },
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1080
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1081 RotateRight: function() {
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1082 var canvas = this.GetActiveCanvas();
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1083 if (canvas != '') {
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1084 stone.RotateRight(canvas);
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1085 }
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1086 },
e8b9a2ba1df1 Added left/right rotation buttons
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1982
diff changeset
1087
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1088 ApplyPreferences: function() {
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1089 this.modalPreferences = false;
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1090
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1091 stone.SetLinearInterpolation(localStorage.settingLinearInterpolation);
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1092
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1093 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
1094 document.location.reload();
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1095 }
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1096 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1097
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1098 HideAllTooltips: function() {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1099 $('[data-toggle="tooltip"]').tooltip('hide');
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1100 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1101
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1102 SetMouseButtonActions: function(tool, left, middle, right) {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1103 this.mouseActionsVisible = false;
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1104 this.mouseTool = tool;
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
1105 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
1106 },
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1107
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1108 SetLeftMouseButtonAction: function(tool, left) {
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1109 this.mouseActionsVisible = false;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1110 this.mouseTool = tool;
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1111 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
1112 stone.GetRightMouseButtonAction());
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1113 },
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1114
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1115 LoadOsiriXAnnotations: function(xml, clearPrevious)
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1116 {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1117 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1118 var seriesInstanceUid = stone.GetStringBuffer();
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1119
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1120 this.SetViewportLayout('1x1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1121 this.leftVisible = false;
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1122 this.SetViewportSeriesInstanceUid(1, seriesInstanceUid);
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1123
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1124 stone.FocusFirstOsiriXAnnotation('canvas1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1125 }
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1126 },
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1127
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1128 ToggleWindowing: function()
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1129 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1130 if (this.showWindowing)
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1131 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1132 this.showWindowing = false;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1133 }
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1134 else
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1135 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1136 stone.LoadWindowingPresets(this.GetActiveCanvas());
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1137 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
1138
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1139 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
1140 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
1141 $('#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
1142 //$('#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
1143 //$('#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
1144
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1145 this.showWindowing = true;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
1146 }
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1147 },
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1148
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1149 FormatDate: function(date)
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1150 {
1698
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1151 if (date === undefined ||
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1152 date.length == 0) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1153 return '';
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1154 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1155 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1156 var format = this.globalConfiguration['DateFormat'];
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1157 if (format === undefined) {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1158 // 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
1159 return date;
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1160 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1161 else {
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1162 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
1163 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
1164 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
1165 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
1166 }
8805a6a01655 "DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1697
diff changeset
1167 }
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1168 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1169
1859
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1170 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
1171 {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1172 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
1173 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
1174 return '';
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1175 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1176 else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1177 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
1178 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
1179 // 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
1180 return time;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1181 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1182 else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1183 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
1184 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
1185 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
1186 if (m) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1187 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
1188 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
1189 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
1190 } else {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1191 return format;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1192 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1193 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1194 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
1195 if (m) {
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1196 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
1197 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
1198 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
1199 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1200 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1201
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1202 return time;
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1203 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1204 }
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1205 },
58681a5c727b overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents: 1849
diff changeset
1206
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1207 DownloadJpeg: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1208 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1209 var canvas = document.getElementById(this.GetActiveCanvas());
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1210 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
1211 },
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1212
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1213 SetCombinedToolActions: function()
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1214 {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1215 var left = stone.WebViewerAction.WINDOWING;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1216 var middle = stone.WebViewerAction.PAN;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1217 var right = stone.WebViewerAction.ZOOM;
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1218
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1219 var behaviour = this.globalConfiguration['CombinedToolBehaviour'];
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1220 if (behaviour !== undefined) {
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1221 left = ConvertMouseAction(behaviour['LeftMouseButton'], left);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1222 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1223 right = ConvertMouseAction(behaviour['RightMouseButton'], right);
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1224 }
1820
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1225
5baaad557d58 don't change mouse tool after creating an annotation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1815
diff changeset
1226 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
1227 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1228
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1229 CheckIsDownloadComplete: function()
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1230 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1231 if (this.creatingArchive &&
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1232 this.archiveJob.length > 0) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1233
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1234 var that = this;
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1235 axios.get(that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1236 headers: axiosHeaders
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1237 })
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1238 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1239 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
1240 var state = response.data['State'];
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1241 if (state == 'Success') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1242 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
1243 var uri = that.globalConfiguration.OrthancApiRoot + '/jobs/' + that.archiveJob + '/archive';
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1244 TriggerDownloadFromUri(uri, that.archiveJob + '.zip', 'application/zip');
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1245 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1246 else if (state == 'Running') {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1247 setTimeout(that.CheckIsDownloadComplete, 1000);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1248 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1249 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1250 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
1251 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1252 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1253 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1254 .catch(function(error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1255 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
1256 that.creatingArchive = false;
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1257 });
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1258 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1259 },
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1260
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
1261 DownloadStudy: function(studyInstanceUid, event)
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1262 {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1263 console.log('Creating archive for study: ' + studyInstanceUid);
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1264
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1265 var that = this;
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1266 axios.post(this.globalConfiguration.OrthancApiRoot + '/tools/lookup', studyInstanceUid, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1267 headers: axiosHeaders
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1268 })
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1269 .then(function(response) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1270 if (response.data.length != 1) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1271 throw('');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1272 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1273 else {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1274 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
1275
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1276 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
1277 if (that.globalConfiguration.DownloadDicomDir === true) {
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1278 uri = uri + '/media';
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1279 } else {
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1280 uri = uri + '/archive';
251d7f7a6c4e New configuration option "DownloadDicomDir" in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1842
diff changeset
1281 }
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
1282
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1283 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
1284 // 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
1285 // 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
1286 event.preventDefault();
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1287 TriggerDownloadFromUri(uri, orthancId + '.zip', 'application/zip');
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
1288 } 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
1289 // 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
1290 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
1291 'Asynchronous' : true
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1292 }, {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1293 headers: axiosHeaders
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
1294 })
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1295 .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
1296 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
1297 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
1298 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
1299 });
9568082ee013 If available, use ZIP streaming from Orthanc >= 1.9.4 to create archives
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1827
diff changeset
1300 }
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1301 }
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1302 })
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1303 .catch(function (error) {
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1304 alert('Cannot find the study in Orthanc');
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1305 });
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1306 },
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1307
2026
04148de691a7 integration mainline->deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2003 2023
diff changeset
1308 ApplyDeepLearning: function() {
04148de691a7 integration mainline->deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2003 2023
diff changeset
1309 stone.ApplyDeepLearningModel(this.GetActiveCanvas());
2029
0cb8796c2a9b measure time for deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
1310 app.deepLearningStartTime = performance.now();
1950
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1311 },
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1312
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1313 ChangeActiveSeries: function(offset) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1314 var seriesTags = this.GetActiveViewportSeriesTags();
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1315 if (seriesTags !== null) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1316 var studyIndex = LookupIndexOfResource(this.studies, STUDY_INSTANCE_UID, seriesTags[STUDY_INSTANCE_UID]);
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1317 if (studyIndex != -1) {
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1318 var virtualSeriesId = this.GetActiveVirtualSeries();
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1319 if (virtualSeriesId.length > 0) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1320 virtualSeriesId = virtualSeriesId[0];
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1321 } else {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1322 virtualSeriesId = '';
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1323 }
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1324
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1325 var seriesInStudyIndices = this.studies[studyIndex].series;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1326 for (var i = 0; i < seriesInStudyIndices.length; i++) {
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1327 var series = this.series[seriesInStudyIndices[i]];
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1328 if (this.series[seriesInStudyIndices[i]].tags[SERIES_INSTANCE_UID] == seriesTags[SERIES_INSTANCE_UID]) {
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1329 if (series.virtualSeries !== null) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1330 for (var j = 0; j < series.virtualSeries.length; j++) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1331 if (series.virtualSeries[j].ID == virtualSeriesId) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1332 var next = j + offset;
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1333 if (next >= 0 &&
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1334 next < series.virtualSeries.length) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1335 this.SetViewportVirtualSeries(this.activeViewport, seriesTags[SERIES_INSTANCE_UID], series.virtualSeries[next].ID);
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1336 }
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1337 return;
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1338 }
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1339 }
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1340 }
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1341 else {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1342 var next = i + offset;
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1343 if (next >= 0 &&
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1344 next < seriesInStudyIndices.length) {
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1345 this.SetViewportSeriesInstanceUid(this.activeViewport, this.series[seriesInStudyIndices[next]].tags[SERIES_INSTANCE_UID]);
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1346 }
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1347 return;
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1348 }
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1349 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1350 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1351 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1352 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1353 },
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1354
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1355 ChangeActiveStudy: function(offset) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1356 var seriesTags = this.GetActiveViewportSeriesTags();
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1357 if (seriesTags !== null) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1358 var studyIndex = LookupIndexOfResource(this.studies, STUDY_INSTANCE_UID, seriesTags[STUDY_INSTANCE_UID]);
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1359 if (studyIndex != -1) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1360 var next = studyIndex + offset;
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1361 if (next >= 0 &&
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1362 next < this.studies.length) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1363 var nextStudy = this.studies[next];
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1364 if (nextStudy.series.length > 0) {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1365 var seriesIndex = nextStudy.series[0];
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1366 if (this.series[seriesIndex].virtualSeries !== null) {
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1367 this.ClickVirtualSeries(seriesIndex, this.series[seriesIndex].virtualSeries[0].ID);
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1368 } else {
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1369 this.ClickSeries(seriesIndex);
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1370 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1371 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1372 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1373 }
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1374 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1375 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378 mounted: function() {
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1379 // Warning: In this function, the "stone" global object is not initialized yet!
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1380
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 this.SetViewportLayout('1x1');
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1382
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1383 if (localStorage.settingNotDiagnostic) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1384 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1385 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1386
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1387 if (localStorage.settingSoftwareRendering) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1388 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1389 }
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1390
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1391 if (localStorage.settingLinearInterpolation) {
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1392 this.settingLinearInterpolation = (localStorage.settingLinearInterpolation == '1');
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1393 }
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1394
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1395 var that = this;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1396
1849
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1397 window.addEventListener('VirtualSeriesThumbnailLoaded', function(args) {
023cce3d7844 introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1843
diff changeset
1398 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
1399 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1400
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1401 window.addEventListener('ThumbnailLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1402 //var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1403 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1404 that.UpdateSeriesThumbnail(seriesInstanceUid);
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1405 });
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1406
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1407 window.addEventListener('MetadataLoaded', function(args) {
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1408 var studyInstanceUid = args.detail.studyInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1409 var seriesInstanceUid = args.detail.seriesInstanceUid;
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1410 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
2017
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1411
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1412 // Automatically open the first series to be loaded (new in Stone Web viewer 2.5)
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1413 if (that.isFirstSeries) {
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1414 that.SetViewportSeriesInstanceUid(1, seriesInstanceUid);
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1415 that.isFirstSeries = false;
7e45941acc1d automatically open the first series to be loaded
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2016
diff changeset
1416 }
1703
76c590a62755 start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1702
diff changeset
1417 });
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1418
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1419 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
1420 // Ignore
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1421 });
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1422
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1423 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
1424 // Ignore
1815
b81775f1b196 New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1807
diff changeset
1425 });
2001
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1426
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1427 window.addEventListener('TextAnnotationRequired', function(args) {
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1428 var label = prompt('Enter your annotation:', '');
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1429 if (label !== null) {
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1430 stone.AddTextAnnotation(args.detail.canvasId, label,
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1431 args.detail.pointedX, args.detail.pointedY,
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1432 args.detail.labelX, args.detail.labelY);
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1433 }
e943a84da9ac creation of text annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1998
diff changeset
1434 });
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1435
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1436 window.addEventListener('keydown', function(event) {
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1437 var canvas = that.GetActiveCanvas();
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1438 if (canvas != '') {
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1439 switch (event.key) {
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1440 case 'Left':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1441 case 'ArrowLeft':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1442 stone.DecrementFrame(canvas, false);
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1443 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1444
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1445 case 'Right':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1446 case 'ArrowRight':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1447 stone.IncrementFrame(canvas, false);
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1448 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1449
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1450 case 'Up':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1451 case 'ArrowUp':
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1452 that.ChangeActiveSeries(-1);
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1453 break
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1454
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1455 case 'Down':
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1456 case 'ArrowDown':
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1457 that.ChangeActiveSeries(1);
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1458 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1459
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1460 case 'PageUp':
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1461 that.ChangeActiveStudy(-1);
2022
96d20b42e740 support of virtual series upon up/down keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2020
diff changeset
1462 break;
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1463
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1464 case 'PageDown':
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1465 that.ChangeActiveStudy(1);
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1466 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1467
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1468 case ' ':
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1469 case 'Space':
2020
88673f50d7b9 added key bindings to change active study and series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2019
diff changeset
1470 dispatchEvent(new CustomEvent('KeyCineSwitch', { }));
2019
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1471 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1472
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1473 default:
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1474 break;
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1475 }
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1476 }
fe9999d6a636 handling of left, right, and space keys
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2017
diff changeset
1477 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1478 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1479 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1480
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1481
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1482
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1483 window.addEventListener('StoneInitialized', function() {
1959
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1484 /**
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1485 * Do NOT modify the order of the calls to "stone.XXX()" in this
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1486 * section, otherwise the HTTP headers might not be properly set.
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1487 **/
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1488
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1489 stone.Setup(Module);
1713
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1490 stone.SetDicomWebRoot(app.globalConfiguration.DicomWebRoot,
aec45e0b2528 configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1710
diff changeset
1491 true /* assume "/rendered" is available in DICOMweb (could be a configuration option) */);
1996
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1492 stone.SetSoftwareRendering(app.settingSoftwareRendering);
6e4ef6e3b2bf linear interpolation of images can be turned off in the user preferences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1993
diff changeset
1493 stone.SetLinearInterpolation(app.settingLinearInterpolation);
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1494
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1495 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
1496 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
1497 }
1761
28755e42c007 Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1739
diff changeset
1498
1959
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1499 // Calls to "stone.AddHttpHeader()" must be after "stone.SetDicomWebRoot()",
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1500 // and before "stone.SetSkipSeriesFromModalities()"
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1501 for (var header in app.globalConfiguration.DicomWebHttpHeaders) {
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1502 stone.AddHttpHeader(header, app.globalConfiguration.DicomWebHttpHeaders[header]);
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1503 }
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1504
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1505 // Bearer token is new in Stone Web viewer 2.0
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1506 var token = getParameterFromUrl('token');
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1507 if (token !== undefined) {
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1508 hasAuthorizationToken = true;
1959
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1509 stone.AddHttpHeader('Authorization', 'Bearer ' + token);
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1510 axiosHeaders['Authorization'] = 'Bearer ' + token;
1959
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1511 }
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1512
2023
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1513 if (app.globalConfiguration.OrthancApiRoot) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1514 axios.get(app.globalConfiguration.OrthancApiRoot + '/system', {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1515 headers: axiosHeaders
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1516 })
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1517 .then(function (response) {
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1518 app.orthancSystem = response.data;
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1519 });
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1520 }
e0b7b2a8b914 support generation of ZIP archives in the presence of authorization tokens
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2022
diff changeset
1521
1959
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1522
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1523 /**
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1524 * Calls to "stone.XXX()" can be reordered after this point.
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1525 **/
889892e51545 Fix handling of "token": The authorization header was not set in QIDO-RS requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1958
diff changeset
1526
1862
63587fdeec69 added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents: 1861
diff changeset
1527 if ('SkipSeriesFromModalities' in app.globalConfiguration) {
63587fdeec69 added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents: 1861
diff changeset
1528 stone.SetSkipSeriesFromModalities(JSON.stringify(app.globalConfiguration.SkipSeriesFromModalities));
63587fdeec69 added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents: 1861
diff changeset
1529 }
63587fdeec69 added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents: 1861
diff changeset
1530
1958
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1531 if (app.globalConfiguration.ShowInfoPanelAtStartup == 'Always') {
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1532 app.modalNotDiagnostic = true;
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1533 } else if (app.globalConfiguration.ShowInfoPanelAtStartup == 'Never') {
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1534 app.modalNotDiagnostic = false;
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1535 } else if (app.globalConfiguration.ShowInfoPanelAtStartup == 'User') {
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1536 app.modalNotDiagnostic = app.settingNotDiagnostic;
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1537 } else {
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1538 alert('Bad value for option "ShowInfoPanelAtStartup": ' + app.globalConfiguration.ShowInfoPanelAtStartup);
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1539 }
142c7ee8fe1f added configuration options: ShowInfoPanelAtStartup, ShowUserPreferencesButton, and ShowNotForDiagnosticUsageDisclaimer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1540
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
1541 console.warn('Stone properly initialized');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1542
1827
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
1543 app.stoneWebViewerVersion = stone.GetStoneWebViewerVersion();
21ccc00839f7 upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1824
diff changeset
1544 app.emscriptenVersion = stone.GetEmscriptenVersion();
1824
a56bf4c534ef display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1820
diff changeset
1545
1701
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1546 app.SetCombinedToolActions();
b5a8bf32d969 new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1700
diff changeset
1547
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1548 var selectedStudies = getParameterFromUrl('selectedStudies');
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1549 var patient = getParameterFromUrl('patient');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1550 var study = getParameterFromUrl('study');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1551 var series = getParameterFromUrl('series');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1552
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1553 if (selectedStudies !== undefined) {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1554 app.selectedStudies = selectedStudies.split(',');
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1555 } else {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1556 app.selectedStudies = [];
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
1557 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1558
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1559 if (study !== undefined &&
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1560 series !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1561 console.warn('Loading series: ' + series + ' from study: ' + study);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1562 stone.FetchSeries(study, series);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1563 app.leftMode = 'full';
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1564 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1565 else {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1566 var empty = true;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1567
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1568 if (study !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1569 var studies = study.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1570 if (studies.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1571 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1572 for (var i = 0; i < studies.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1573 console.warn('Loading study: ' + studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1574 stone.FetchStudy(studies[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1575 }
1691
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
1576 }
1702
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1577 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1578
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1579 if (patient !== undefined) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1580 var patients = patient.split(',');
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1581 if (patients.length != 0) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1582 empty = false;
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1583 for (var i = 0; i < patients.length; i++) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1584 console.warn('Loading patient: ' + patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1585 stone.FetchPatient(patients[i]);
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1586 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1587 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1588 }
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1589
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1590 if (empty) {
bc40b6450261 "patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1701
diff changeset
1591 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
1592 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1593 }
2016
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1594
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1595 // New in Stone Web viewer 2.5
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1596 var menu = getParameterFromUrl('menu');
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1597 if (menu !== undefined) {
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1598 if (menu == 'hidden') {
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1599 app.leftVisible = false;
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1600 } else if (menu == 'small' ||
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1601 menu == 'grid' ||
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1602 menu == 'full') {
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1603 app.leftVisible = true;
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1604 app.leftMode = menu;
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1605 } else {
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1606 alert('Bad value for the "menu" option in the URL (can be "hidden", "small", "grid", or "full"): ' + menu);
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1607 }
f30d7055ed6a new URL argument "menu" to change the layout of the list of studies/series
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2015
diff changeset
1608 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1609 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1610
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1611
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1612 window.addEventListener('ResourcesLoaded', function() {
1862
63587fdeec69 added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents: 1861
diff changeset
1613 console.log('resources loaded: ', stone.GetStudiesCount(), 'studies &', stone.GetSeriesCount(), 'series');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1614
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1615 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1616 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
1617 stone.LoadStudyTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1618 studies.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1619 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1620
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1621 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1622 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
1623 stone.LoadSeriesTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1624 series.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1625 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1626
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1627 app.SetResources(studies, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1628
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1629 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
1630 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
1631 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
1632 app.UpdateSeriesThumbnail(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
1633 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1634 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1635 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1636
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1637
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1638 window.addEventListener('StoneException', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1639 console.error('Exception catched in Stone');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1640 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1641
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1642
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1643
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1644 function ParseJsonWithComments(json)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1645 {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1646 if (typeof(json) == 'string') {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1647 // https://stackoverflow.com/a/62945875/881731
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1648 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
1649 (m, g) => g ? "" : m));
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1650 } else {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1651 return json;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1652 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1653 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1654
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1655
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1656 $(document).ready(function() {
1709
2931f5e15320 download study from Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1707
diff changeset
1657 RefreshTooltips();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1658
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
1659 //app.modalWarning = true;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1660
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1661 axios.get(CONFIGURATION_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1662 .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
1663 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
1664
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1665 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
1666 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
1667 app.globalConfiguration = {};
f1bd464dc3e1 the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1699
diff changeset
1668 }
1697
c2802561d7f9 "PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1696
diff changeset
1669
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1670 // 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
1671
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1672 /*
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1673 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1674 script.src = WASM_SOURCE;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1675 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1676 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1677 */
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1678
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1679 // 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
1680 // explicitly report errors)
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1681
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1682 axios.get(WASM_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1683 .then(function (response) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1684 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1685 script.innerHTML = response.data;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1686 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1687 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1688 })
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1689 .catch(function (error) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1690 alert('Cannot load the WebAssembly framework');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1691 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1692 })
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1693 .catch(function (error) {
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1694 alert('Cannot load the configuration file');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
1695 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1696 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1697
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1698
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1699 // "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
1700 // studies: https://stackoverflow.com/questions/26639346
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1701 $('.dropdown-menu').click(function(e) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1702 e.stopPropagation();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1703 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1704
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1705
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1706 // 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
1707 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
1708
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1709
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1710 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
1711 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
1712 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
1713 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
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1715 if (expectedOrigin === undefined) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1716 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
1717 '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
1718 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1719 else if (expectedOrigin != '*' &&
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1720 e.origin !== expectedOrigin) {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1721 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
1722 '", 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
1723 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1724 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
1725 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
1726 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
1727 clear = e.data.clear;
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1728 }
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1729
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1730 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
1731 }
1611
787db80a5a1b new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1603
diff changeset
1732 }
1714
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1733 else {
a878e807cd96 configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1713
diff changeset
1734 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
1735 }
1707
ee2b5990dfff remove annoying alert box in the server demo
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1706
diff changeset
1736 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
1737 });
1950
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1738
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1739
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1740 window.addEventListener('DeepLearningInitialized', function() {
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1741 stone.LoadDeepLearningModel('model.message');
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1742 });
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1743
1951
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1744 window.addEventListener('DeepLearningModelReady', function() {
1950
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1745 app.deepLearningReady = true;
1951
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1746 app.deepLearningProgress = 0;
1950
6ffd65cfd2ee new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1949
diff changeset
1747 });
1951
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1748
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1749 window.addEventListener('DeepLearningStep', function(args) {
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1750 app.deepLearningProgress = args.detail.progress;
2029
0cb8796c2a9b measure time for deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
1751 console.log('Elapsed time: ' + Math.round(performance.now() - app.deepLearningStartTime) + 'ms');
1951
060d61913e39 deep learning in steps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1950
diff changeset
1752 });