Mercurial > hg > orthanc-stone
annotate Applications/StoneWebViewer/WebApplication/app.js @ 1703:76c590a62755
start work on series with multiple multiframe instances
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Nov 2020 16:36:43 +0100 |
parents | bc40b6450261 |
children | 902d13889ae4 |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
16 * |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
22 var CONFIGURATION_SOURCE = 'configuration.json'; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
23 var WASM_SOURCE = 'StoneWebViewer.js'; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
24 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 var COLORS = [ 'blue', 'red', 'green', 'yellow', 'violet' ]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 var SERIES_INSTANCE_UID = '0020,000e'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 var STUDY_INSTANCE_UID = '0020,000d'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 var STUDY_DESCRIPTION = '0008,1030'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 var STUDY_DATE = '0008,0020'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
31 // 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
|
32 var pendingSeriesPdf_ = {}; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
33 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 function getParameterFromUrl(key) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 var url = window.location.search.substring(1); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 var args = url.split('&'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 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
|
39 var arg = args[i].split('='); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 if (arg[0] == key) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 return arg[1]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
47 // https://stackoverflow.com/a/21797381/881731 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
48 function Base64ToArrayBuffer(base64) { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
49 var binary_string = window.atob(base64); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
50 var len = binary_string.length; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
51 var bytes = new Uint8Array(len); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
52 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
|
53 bytes[i] = binary_string.charCodeAt(i); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
54 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
55 return bytes.buffer; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
56 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
57 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
58 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
59 function SaveDataUriScheme(filename, dataUriScheme) { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
60 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
|
61 var base64 = dataUriScheme.split(',')[1]; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
62 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
63 var blob = new Blob([ Base64ToArrayBuffer(base64) ], { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
64 type: mimeType |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
65 }); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
66 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
67 var link = document.createElement('a'); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
68 link.href = window.URL.createObjectURL(blob); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
69 link.download = filename; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
70 link.click(); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
71 }; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
72 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
73 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
74 // 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
|
75 // possible values |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
76 function ConvertMouseAction(config, defaultAction) |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
77 { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
78 if (config === undefined) { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
79 return defaultAction; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
80 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
81 if (config == "Windowing") { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
82 return stone.WebViewerAction.WINDOWING; |
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 else if (config == "Zoom") { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
85 return stone.WebViewerAction.ZOOM; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
86 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
87 else if (config == "Pan") { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
88 return stone.WebViewerAction.PAN; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
89 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
90 else if (config == "Rotate") { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
91 return stone.WebViewerAction.ROTATE; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
92 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
93 else if (config == "Crosshair") { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
94 return stone.WebViewerAction.CROSSHAIR; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
95 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
96 else { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
97 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
|
98 return stone.WebViewerAction.PAN; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
99 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
100 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
101 |
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 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 Vue.component('viewport', { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 props: [ 'left', 'top', 'width', 'height', 'canvasId', 'active', 'series', 'viewportIndex', |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
106 'showInfo' ], |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 template: '#viewport-template', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 data: function () { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 return { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 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
|
111 status: 'waiting', |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
112 currentFrame: 0, |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
113 numberOfFrames: 0, |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
114 quality: '', |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
115 cineControls: false, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
116 cineIncrement: 0, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
117 cineFramesPerSecond: 30, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
118 cineTimeoutId: null, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
119 cineLoadingFrame: false |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 }, |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
122 watch: { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
123 currentFrame: function(newVal, oldVal) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
124 /** |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
125 * The "FrameUpdated" event has been received, which indicates |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
126 * that the schedule frame has been displayed: The cine loop can |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
127 * proceed to the next frame (check out "CineCallback()"). |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
128 **/ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
129 this.cineLoadingFrame = false; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
130 }, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 series: function(newVal, oldVal) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 this.status = 'loading'; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
133 this.cineControls = false; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
134 this.cineMode = ''; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
135 this.cineLoadingFrame = false; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
136 this.cineRate = 30; // Default value |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
137 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
138 if (this.cineTimeoutId !== null) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
139 clearTimeout(this.cineTimeoutId); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
140 this.cineTimeoutId = null; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
141 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 var studyInstanceUid = newVal.tags[STUDY_INSTANCE_UID]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 var seriesInstanceUid = newVal.tags[SERIES_INSTANCE_UID]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 stone.SpeedUpFetchSeriesMetadata(studyInstanceUid, seriesInstanceUid); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
146 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 if ((newVal.type == stone.ThumbnailType.IMAGE || |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 newVal.type == stone.ThumbnailType.NO_PREVIEW) && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 newVal.complete) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 this.status = 'ready'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 var that = this; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 Vue.nextTick(function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 stone.LoadSeriesInViewport(that.canvasId, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
157 else if (newVal.type == stone.ThumbnailType.PDF) { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
158 if (newVal.complete) { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
159 /** |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
160 * Series is complete <=> One already knows about the |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
161 * SOPInstanceUIDs that are available in this series. As a |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
162 * consequence, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
163 * "OrthancStone::SeriesMetadataLoader::Accessor" will not |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
164 * be empty in "ResourcesLoader::FetchPdf()" in C++ code. |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
165 **/ |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
166 stone.FetchPdf(studyInstanceUid, seriesInstanceUid); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
167 } else { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
168 /** |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
169 * The SOPInstanceUIDs in this series are not known |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
170 * yet. Schedule an "stone.FetchPdf()" one the series |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
171 * metadata is available. |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
172 **/ |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
173 pendingSeriesPdf_[seriesInstanceUid] = true; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
174 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
175 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
176 else if (newVal.type == stone.ThumbnailType.VIDEO) { |
1661
e4589378ad8b
warning message about unsupported videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1657
diff
changeset
|
177 this.status = 'video'; |
e4589378ad8b
warning message about unsupported videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1657
diff
changeset
|
178 console.warn('Videos are not supported by the Stone Web viewer yet'); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 }, |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
182 mounted: function() { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
183 var that = this; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
184 |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
185 window.addEventListener('FrameUpdated', function(args) { |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
186 if (args.detail.canvasId == that.canvasId) { |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
187 that.currentFrame = (args.detail.currentFrame + 1); |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
188 that.numberOfFrames = args.detail.numberOfFrames; |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
189 that.quality = args.detail.quality; |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
190 } |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
191 }); |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
192 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
193 window.addEventListener('SeriesDetailsReady', function(args) { |
1673
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
194 if (args.detail.canvasId == that.canvasId) { |
dd50f8a1a2be
simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
195 that.cineFramesPerSecond = stone.GetCineRate(that.canvasId); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
196 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
197 }); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
198 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
199 window.addEventListener('PdfLoaded', function(args) { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
200 var studyInstanceUid = args.detail.studyInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
201 var seriesInstanceUid = args.detail.seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
202 var pdfPointer = args.detail.pdfPointer; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
203 var pdfSize = args.detail.pdfSize; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
204 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
205 if ('tags' in that.series && |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
206 that.series.tags[STUDY_INSTANCE_UID] == studyInstanceUid && |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
207 that.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
208 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
209 that.status = 'pdf'; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
210 var pdf = new Uint8Array(HEAPU8.subarray(pdfPointer, pdfPointer + pdfSize)); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
211 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
212 /** |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
213 * 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
|
214 * 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
|
215 * 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
|
216 * populated after the component has been rendered", so we |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
217 * wait for the next rendering. |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
218 * 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
|
219 **/ |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
220 Vue.nextTick(function() { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
221 that.$refs.pdfViewer.LoadPdf(pdf); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
222 }); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
223 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
224 }); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
225 }, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 methods: { |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
227 DragDrop: function(event) { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 event.preventDefault(); |
1547
bf195fc0797e
fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
229 |
bf195fc0797e
fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
230 // The "parseInt()" is because of Microsoft Edge Legacy (*) |
bf195fc0797e
fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
231 this.$emit('updated-series', parseInt(event.dataTransfer.getData('seriesIndex'), 10)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 MakeActive: function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 this.$emit('selected-viewport'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 }, |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
236 DecrementFrame: function(isCircular) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
237 return stone.DecrementFrame(this.canvasId, isCircular); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
238 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
239 IncrementFrame: function(isCircular) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
240 return stone.IncrementFrame(this.canvasId, isCircular); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
241 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
242 CinePlay: function() { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
243 this.cineControls = true; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
244 this.cineIncrement = 1; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
245 this.UpdateCine(); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
246 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
247 CinePause: function() { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
248 if (this.cineIncrement == 0) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
249 // 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
|
250 this.cineControls = !this.cineControls; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
251 } else { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
252 this.cineIncrement = 0; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
253 this.UpdateCine(); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
254 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
255 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
256 CineBackward: function() { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
257 this.cineControls = true; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
258 this.cineIncrement = -1; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
259 this.UpdateCine(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 }, |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
261 UpdateCine: function() { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
262 // Cancel the previous cine loop, if any |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
263 if (this.cineTimeoutId !== null) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
264 clearTimeout(this.cineTimeoutId); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
265 this.cineTimeoutId = null; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
266 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
267 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
268 this.cineLoadingFrame = false; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
269 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
270 if (this.cineIncrement != 0) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
271 this.CineCallback(); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
272 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
273 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
274 CineCallback: function() { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
275 var reschedule; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
276 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
277 if (this.cineLoadingFrame) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
278 /** |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
279 * 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
|
280 * "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
|
281 * "FrameUpdated" event). Otherwise, the background loading |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
282 * 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
|
283 * advancement of the current frame, which freezes the |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
284 * display. |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
285 **/ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
286 reschedule = true; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
287 } else { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
288 this.cineLoadingFrame = true; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
289 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
290 if (this.cineIncrement == 1) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
291 reschedule = this.DecrementFrame(true /* circular */); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
292 } else if (this.cineIncrement == -1) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
293 reschedule = this.IncrementFrame(true /* circular */); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
294 } else { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
295 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
|
296 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
297 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
298 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
299 if (reschedule) { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1665
diff
changeset
|
300 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
|
301 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 } |
1651 | 304 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 var app = new Vue({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 el: '#wv', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 data: function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 return { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 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
|
312 ready: false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 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
|
314 leftVisible: true, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 viewportLayoutButtonsVisible: false, |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
316 mouseActionsVisible: false, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 activeViewport: 0, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 showInfo: true, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 showReferenceLines: true, |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1692
diff
changeset
|
320 synchronizedBrowsing: false, |
1697
c2802561d7f9
"PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1696
diff
changeset
|
321 globalConfiguration: {}, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
322 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
323 modalWarning: false, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
324 modalNotDiagnostic: false, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
325 modalPreferences: false, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
326 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
327 // 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
|
328 settingNotDiagnostic: true, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
329 settingSoftwareRendering: false, |
1562
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
330 |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
331 layoutCountX: 1, |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
332 layoutCountY: 1, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 viewport1Width: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 viewport1Height: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 viewport1Left: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 viewport1Top: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 viewport1Visible: true, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 viewport1Series: {}, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 viewport2Width: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 viewport2Height: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 viewport2Left: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 viewport2Top: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 viewport2Visible: false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 viewport2Series: {}, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 viewport3Width: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 viewport3Height: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 viewport3Left: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 viewport3Top: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 viewport3Visible: false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 viewport3Series: {}, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 viewport4Width: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 viewport4Height: '100%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 viewport4Left: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 viewport4Top: '0%', |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 viewport4Visible: false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 viewport4Series: {}, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
362 showWindowing: false, |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
363 windowingPresets: [], |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
364 |
1692
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
365 selectedStudies: [], |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 series: [], |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 studies: [], |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
368 seriesIndex: {}, // Maps "SeriesInstanceUID" to "index in this.series" |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
369 multiframeInstanceThumbnails: {} |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 computed: { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 getSelectedStudies() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 var s = ''; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 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
|
376 if (this.studies[i].selected) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 if (s.length > 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 s += ', '; |
1698
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
379 s += this.studies[i].tags[STUDY_DESCRIPTION]; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
380 |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
381 var date = this.studies[i].tags[STUDY_DATE]; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
382 if (date.length > 0) { |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
383 s += ' [' + this.FormatDate(date) + ']'; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
384 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 if (s.length == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 return '...'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 return s; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 watch: { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 leftVisible: function(newVal, oldVal) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
395 this.FitContent(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
397 showReferenceLines: function(newVal, oldVal) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
398 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
|
399 }, |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1692
diff
changeset
|
400 synchronizedBrowsing: function(newVal, oldVal) { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1692
diff
changeset
|
401 stone.SetSynchronizedBrowsingEnabled(newVal ? 1 : 0); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1692
diff
changeset
|
402 }, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
403 settingNotDiagnostic: function(newVal, oldVal) { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
404 localStorage.settingNotDiagnostic = (newVal ? '1' : '0'); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
405 }, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
406 settingSoftwareRendering: function(newVal, oldVal) { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
407 localStorage.settingSoftwareRendering = (newVal ? '1' : '0'); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 methods: { |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
411 FitContent: function() { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 // 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
|
413 if (typeof stone._AllViewportsUpdateSize !== 'undefined') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 this.$nextTick(function () { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 stone.AllViewportsUpdateSize(true /* fit content */); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
417 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
420 GetActiveSeries: function() { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 var s = []; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 if ('tags' in this.viewport1Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 s.push(this.viewport1Series.tags[SERIES_INSTANCE_UID]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 if ('tags' in this.viewport2Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 s.push(this.viewport2Series.tags[SERIES_INSTANCE_UID]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
428 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
429 if ('tags' in this.viewport3Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 s.push(this.viewport3Series.tags[SERIES_INSTANCE_UID]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 if ('tags' in this.viewport4Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 s.push(this.viewport4Series.tags[SERIES_INSTANCE_UID]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 return s; |
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 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
438 GetActiveCanvas: function() { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 if (this.activeViewport == 1) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 return 'canvas1'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 else if (this.activeViewport == 2) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 return 'canvas2'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 else if (this.activeViewport == 3) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 return 'canvas3'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 else if (this.activeViewport == 4) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 return 'canvas4'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 else { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 return 'canvas1'; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 SetResources: function(sourceStudies, sourceSeries) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 var indexStudies = {}; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 var studies = []; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 var posColor = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
461 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
462 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
|
463 var studyInstanceUid = sourceStudies[i][STUDY_INSTANCE_UID]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 if (studyInstanceUid !== undefined) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
465 if (studyInstanceUid in indexStudies) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
466 console.error('Twice the same study: ' + studyInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 } else { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
468 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
|
469 |
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
470 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
|
471 this.selectedStudies.includes(studyInstanceUid)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
472 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
473 studies.push({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
474 'studyInstanceUid' : studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
475 'series' : [ ], |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
476 'color' : COLORS[posColor], |
1692
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
477 'selected' : isSelected, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
478 'tags' : sourceStudies[i] |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
479 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
480 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
481 posColor = (posColor + 1) % COLORS.length; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
482 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
483 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
484 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
485 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 var series = []; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
487 var seriesIndex = {}; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 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
|
490 var studyInstanceUid = sourceSeries[i][STUDY_INSTANCE_UID]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
491 var seriesInstanceUid = sourceSeries[i][SERIES_INSTANCE_UID]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 if (studyInstanceUid !== undefined && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
493 seriesInstanceUid !== undefined) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
494 if (studyInstanceUid in indexStudies) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 seriesIndex[seriesInstanceUid] = series.length; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
496 var study = studies[indexStudies[studyInstanceUid]]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
497 study.series.push(i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
498 series.push({ |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
499 'numberOfFrames' : 0, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
500 'complete' : false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
501 'type' : stone.ThumbnailType.LOADING, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
502 'color': study.color, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
503 'tags': sourceSeries[i], |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
504 'multiframeInstances': null |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
505 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
506 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
507 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
508 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
509 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
510 this.studies = studies; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 this.series = series; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 this.seriesIndex = seriesIndex; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
513 this.ready = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
514 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
515 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
516 SeriesDragStart: function(event, seriesIndex) { |
1547
bf195fc0797e
fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
517 // It is necessary to use ".toString()" for Microsoft Edge Legacy (*) |
bf195fc0797e
fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1538
diff
changeset
|
518 event.dataTransfer.setData('seriesIndex', seriesIndex.toString()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 }, |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
520 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
521 SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
522 if (seriesInstanceUid in this.seriesIndex) { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
523 this.SetViewportSeries(viewportIndex, this.seriesIndex[seriesInstanceUid]); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
524 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
525 }, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 SetViewportSeries: function(viewportIndex, seriesIndex) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 var series = this.series[seriesIndex]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 if (viewportIndex == 1) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 this.viewport1Series = series; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 else if (viewportIndex == 2) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 this.viewport2Series = series; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 else if (viewportIndex == 3) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 this.viewport3Series = series; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 else if (viewportIndex == 4) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 this.viewport4Series = series; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 ClickSeries: function(seriesIndex) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 this.SetViewportSeries(this.activeViewport, seriesIndex); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 HideViewport: function(index) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
549 if (index == 1) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 this.viewport1Visible = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 else if (index == 2) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 this.viewport2Visible = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 else if (index == 3) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 this.viewport3Visible = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 else if (index == 4) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 this.viewport4Visible = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
560 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
563 ShowViewport: function(index, left, top, width, height) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 if (index == 1) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 this.viewport1Visible = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 this.viewport1Left = left; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 this.viewport1Top = top; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 this.viewport1Width = width; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
569 this.viewport1Height = height; |
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 else if (index == 2) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
572 this.viewport2Visible = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
573 this.viewport2Left = left; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 this.viewport2Top = top; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 this.viewport2Width = width; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 this.viewport2Height = height; |
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 else if (index == 3) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 this.viewport3Visible = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 this.viewport3Left = left; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 this.viewport3Top = top; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 this.viewport3Width = width; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 this.viewport3Height = height; |
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 else if (index == 4) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 this.viewport4Visible = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 this.viewport4Left = left; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 this.viewport4Top = top; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 this.viewport4Width = width; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 this.viewport4Height = height; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 SetViewportLayout: function(layout) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 this.viewportLayoutButtonsVisible = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 if (layout == '1x1') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 this.ShowViewport(1, '0%', '0%', '100%', '100%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 this.HideViewport(2); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 this.HideViewport(3); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
600 this.HideViewport(4); |
1562
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
601 this.layoutCountX = 1; |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
602 this.layoutCountY = 1; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 else if (layout == '2x2') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 this.ShowViewport(1, '0%', '0%', '50%', '50%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 this.ShowViewport(2, '50%', '0%', '50%', '50%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 this.ShowViewport(3, '0%', '50%', '50%', '50%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 this.ShowViewport(4, '50%', '50%', '50%', '50%'); |
1562
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
609 this.layoutCountX = 2; |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
610 this.layoutCountY = 2; |
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 else if (layout == '2x1') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 this.ShowViewport(1, '0%', '0%', '50%', '100%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 this.ShowViewport(2, '50%', '0%', '50%', '100%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
615 this.HideViewport(3); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
616 this.HideViewport(4); |
1562
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
617 this.layoutCountX = 2; |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
618 this.layoutCountY = 1; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 else if (layout == '1x2') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
621 this.ShowViewport(1, '0%', '0%', '100%', '50%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 this.ShowViewport(2, '0%', '50%', '100%', '50%'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 this.HideViewport(3); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 this.HideViewport(4); |
1562
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
625 this.layoutCountX = 1; |
2a4a6b967053
starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1561
diff
changeset
|
626 this.layoutCountY = 2; |
1495
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 this.FitContent(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
631 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
632 UpdateSeriesThumbnail: function(seriesInstanceUid) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
633 if (seriesInstanceUid in this.seriesIndex) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
634 var index = this.seriesIndex[seriesInstanceUid]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 var series = this.series[index]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
636 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 var type = stone.LoadSeriesThumbnail(seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 series.type = type; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 if (type == stone.ThumbnailType.IMAGE) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 series.thumbnail = stone.GetStringBuffer(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 // 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
|
645 this.$set(this.series, index, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
648 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
649 UpdateIsSeriesComplete: function(studyInstanceUid, seriesInstanceUid) { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 if (seriesInstanceUid in this.seriesIndex) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 var index = this.seriesIndex[seriesInstanceUid]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 var series = this.series[index]; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
654 var oldComplete = series.complete; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
655 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
656 series.complete = stone.IsSeriesComplete(seriesInstanceUid); |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
657 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
658 if (!oldComplete && |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
659 series.complete) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
660 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
661 series.numberOfFrames = stone.GetSeriesNumberOfFrames(seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
662 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
663 if (seriesInstanceUid in pendingSeriesPdf_) { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
664 stone.FetchPdf(studyInstanceUid, seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
665 delete pendingSeriesPdf_[seriesInstanceUid]; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1673
diff
changeset
|
666 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
667 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
668 if (stone.LoadMultiframeInstancesFromSeries(seriesInstanceUid)) { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
669 series.multiframeInstances = JSON.parse(stone.GetStringBuffer()); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
670 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
671 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
672 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
673 // 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
|
674 this.$set(this.series, index, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
675 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
676 if ('tags' in this.viewport1Series && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
677 this.viewport1Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
678 this.$set(this.viewport1Series, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
679 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
680 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
681 if ('tags' in this.viewport2Series && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
682 this.viewport2Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
683 this.$set(this.viewport2Series, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
684 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
685 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
686 if ('tags' in this.viewport3Series && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
687 this.viewport3Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
688 this.$set(this.viewport3Series, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
689 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
690 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
691 if ('tags' in this.viewport4Series && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
692 this.viewport4Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
693 this.$set(this.viewport4Series, series); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
694 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
695 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
696 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
697 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
698 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
|
699 this.showWindowing = false; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
700 var canvas = this.GetActiveCanvas(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 if (canvas != '') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
702 stone.SetWindowing(canvas, center, width); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
706 InvertContrast: function() { |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 var canvas = this.GetActiveCanvas(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 if (canvas != '') { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 stone.InvertContrast(canvas); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 } |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
711 }, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
712 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
713 FlipX: function() { |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
714 var canvas = this.GetActiveCanvas(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
715 if (canvas != '') { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
716 stone.FlipX(canvas); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
717 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
718 }, |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
719 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
720 FlipY: function() { |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
721 var canvas = this.GetActiveCanvas(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
722 if (canvas != '') { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
723 stone.FlipY(canvas); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
724 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
725 }, |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
726 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
727 ApplyPreferences: function() { |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
728 this.modalPreferences = false; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
729 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
730 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
|
731 document.location.reload(); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
732 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
733 }, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
734 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
735 HideAllTooltips: function() { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
736 $('[data-toggle="tooltip"]').tooltip('hide'); |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
737 }, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
738 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
739 SetMouseButtonActions: function(left, middle, right) { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
740 this.mouseActionsVisible = false; |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
741 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
|
742 }, |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
743 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
744 LoadOsiriXAnnotations: function(xml, clearPrevious) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
745 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
746 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
747 var seriesInstanceUid = stone.GetStringBuffer(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
748 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
749 this.SetViewportLayout('1x1'); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
750 this.leftVisible = false; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
751 this.SetViewportSeriesInstanceUid(1, seriesInstanceUid); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
752 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
753 stone.FocusFirstOsiriXAnnotation('canvas1'); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
754 } |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
755 }, |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
756 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
757 ToggleWindowing: function() |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
758 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
759 if (this.showWindowing) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
760 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
761 this.showWindowing = false; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
762 } |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
763 else |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
764 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
765 stone.LoadWindowingPresets(this.GetActiveCanvas()); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
766 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
|
767 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
768 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
|
769 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
|
770 $('#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
|
771 //$('#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
|
772 //$('#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
|
773 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
774 this.showWindowing = true; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
775 } |
1698
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
776 }, |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
777 |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
778 FormatDate: function(date) |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
779 { |
1698
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
780 if (date === undefined || |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
781 date.length == 0) { |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
782 return ''; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
783 } |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
784 else { |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
785 var format = this.globalConfiguration['DateFormat']; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
786 if (format === undefined) { |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
787 // 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
|
788 return date; |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
789 } |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
790 else { |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
791 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
|
792 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
|
793 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
|
794 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
|
795 } |
8805a6a01655
"DateFormat" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1697
diff
changeset
|
796 } |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
797 }, |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
798 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
799 DownloadJpeg: function() |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
800 { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
801 var canvas = document.getElementById(this.GetActiveCanvas()); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
802 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
|
803 }, |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
804 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
805 SetCombinedToolActions: function() |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
806 { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
807 var left = stone.WebViewerAction.WINDOWING; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
808 var middle = stone.WebViewerAction.PAN; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
809 var right = stone.WebViewerAction.ZOOM; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
810 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
811 var behaviour = this.globalConfiguration['CombinedToolBehaviour']; |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
812 if (behaviour !== undefined) { |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
813 left = ConvertMouseAction(behaviour['LeftMouseButton'], left); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
814 middle = ConvertMouseAction(behaviour['MiddleMouseButton'], middle); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
815 right = ConvertMouseAction(behaviour['RightMouseButton'], right); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
816 } |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
817 |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
818 this.SetMouseButtonActions(left, middle, right); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
819 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
822 mounted: function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
823 this.SetViewportLayout('1x1'); |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
824 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
825 if (localStorage.settingNotDiagnostic) { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
826 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1'); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
827 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
828 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
829 if (localStorage.settingSoftwareRendering) { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
830 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1'); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
831 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
832 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
833 this.modalNotDiagnostic = this.settingNotDiagnostic; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
834 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
835 var that = this; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
836 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
837 window.addEventListener('MultiframeInstanceThumbnailLoaded', function(args) { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
838 that.$set(that.multiframeInstanceThumbnails, args.detail.sopInstanceUid, args.detail.thumbnail); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
839 }); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
840 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
841 window.addEventListener('ThumbnailLoaded', function(args) { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
842 //var studyInstanceUid = args.detail.studyInstanceUid; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
843 var seriesInstanceUid = args.detail.seriesInstanceUid; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
844 that.UpdateSeriesThumbnail(seriesInstanceUid); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
845 }); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
846 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
847 window.addEventListener('MetadataLoaded', function(args) { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
848 var studyInstanceUid = args.detail.studyInstanceUid; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
849 var seriesInstanceUid = args.detail.seriesInstanceUid; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
850 that.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
851 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
852 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
853 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
854 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
855 |
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 window.addEventListener('StoneInitialized', function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
858 stone.Setup(Module); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
859 stone.SetOrthancRoot('..', true); |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
860 stone.SetSoftwareRendering(localStorage.settingSoftwareRendering == '1'); |
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
|
861 console.warn('Stone properly initialized'); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
862 |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
863 app.SetCombinedToolActions(); |
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1700
diff
changeset
|
864 |
1692
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
865 var selectedStudies = getParameterFromUrl('selectedStudies'); |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
866 var patient = getParameterFromUrl('patient'); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 var study = getParameterFromUrl('study'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 var series = getParameterFromUrl('series'); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
869 |
1692
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
870 if (selectedStudies !== undefined) { |
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
871 app.selectedStudies = selectedStudies.split(','); |
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
872 } else { |
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
873 app.selectedStudies = []; |
e787b52d025f
"selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1691
diff
changeset
|
874 } |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
875 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
876 if (study !== undefined && |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
877 series !== undefined) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
878 console.warn('Loading series: ' + series + ' from study: ' + study); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
879 stone.FetchSeries(study, series); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
880 app.leftMode = 'full'; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
881 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
882 else { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
883 var empty = true; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
884 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
885 if (study !== undefined) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
886 var studies = study.split(','); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
887 if (studies.length != 0) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
888 empty = false; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
889 for (var i = 0; i < studies.length; i++) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
890 console.warn('Loading study: ' + studies[i]); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
891 stone.FetchStudy(studies[i]); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
892 } |
1691
4a49de03a419
porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
893 } |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
894 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
895 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
896 if (patient !== undefined) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
897 var patients = patient.split(','); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
898 if (patients.length != 0) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
899 empty = false; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
900 for (var i = 0; i < patients.length; i++) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
901 console.warn('Loading patient: ' + patients[i]); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
902 stone.FetchPatient(patients[i]); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
903 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
904 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
905 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
906 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
907 if (empty) { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
908 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
|
909 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
910 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
911 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
913 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
914 window.addEventListener('ResourcesLoaded', function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
915 console.log('resources loaded'); |
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 var studies = []; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
918 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
|
919 stone.LoadStudyTags(i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
920 studies.push(JSON.parse(stone.GetStringBuffer())); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
921 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
922 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
923 var series = []; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
924 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
|
925 stone.LoadSeriesTags(i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
926 series.push(JSON.parse(stone.GetStringBuffer())); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
927 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
928 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
929 app.SetResources(studies, series); |
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 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
|
932 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
|
933 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
|
934 app.UpdateSeriesThumbnail(seriesInstanceUid); |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1651
diff
changeset
|
935 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
936 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
937 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
938 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
939 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
940 window.addEventListener('StoneException', function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
941 console.error('Exception catched in Stone'); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
944 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
945 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
946 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
947 function ParseJsonWithComments(json) |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
948 { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
949 if (typeof(json) == 'string') { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
950 // https://stackoverflow.com/a/62945875/881731 |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
951 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
|
952 (m, g) => g ? "" : m)); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
953 } else { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
954 return json; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
955 } |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
956 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
957 |
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 $(document).ready(function() { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 // Enable support for tooltips in Bootstrap |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
961 $('[data-toggle="tooltip"]').tooltip({ |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
962 placement: 'bottom', |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
963 container: 'body', |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
964 trigger: 'hover' |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1554
diff
changeset
|
965 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
966 |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1547
diff
changeset
|
967 //app.modalWarning = true; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
968 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
969 axios.get(CONFIGURATION_SOURCE) |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
970 .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
|
971 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
|
972 |
f1bd464dc3e1
the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1699
diff
changeset
|
973 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
|
974 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
|
975 app.globalConfiguration = {}; |
f1bd464dc3e1
the plugin uses the Orthanc configuration instead of the default configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1699
diff
changeset
|
976 } |
1697
c2802561d7f9
"PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1696
diff
changeset
|
977 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
978 // 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
|
979 |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
980 /* |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
981 var script = document.createElement('script'); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
982 script.src = WASM_SOURCE; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
983 script.type = 'text/javascript'; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
984 document.body.appendChild(script); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
985 */ |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
986 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
987 // 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
|
988 // explicitly report errors) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
989 |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
990 axios.get(WASM_SOURCE) |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
991 .then(function (response) { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
992 var script = document.createElement('script'); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
993 script.innerHTML = response.data; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
994 script.type = 'text/javascript'; |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
995 document.body.appendChild(script); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
996 }) |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
997 .catch(function (error) { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
998 alert('Cannot load the WebAssembly framework'); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
999 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1000 }) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1001 .catch(function (error) { |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1002 alert('Cannot load the configuration file'); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1003 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1004 }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1005 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1006 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1007 // "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
|
1008 // studies: https://stackoverflow.com/questions/26639346 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 $('.dropdown-menu').click(function(e) { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 e.stopPropagation(); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1013 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1014 // 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
|
1015 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
|
1016 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1017 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1018 window.addEventListener('message', function(e) { |
1613 | 1019 if ('type' in e.data) { |
1697
c2802561d7f9
"PrintEnabled" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1696
diff
changeset
|
1020 var expectedOrigin = app.globalConfiguration['ExpectedMessageOrigin']; |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1021 |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1022 if (expectedOrigin === undefined) { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1023 alert('Dynamic actions are disabled in the Stone Web viewer, ' + |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1024 'set the configuration option "ExpectedMessageOrigin".'); |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1025 } |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1026 else if (expectedOrigin != '*' && |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1027 e.origin !== expectedOrigin) { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1028 alert('Bad origin for a dynamic action in the Stone Web viewer: "' + e.origin + |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1029 '", whereas the message must have origin: "' + expectedOrigin + '"'); |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1603
diff
changeset
|
1030 } |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1031 else if (e.data.type == 'show-osirix-annotations') { |
1613 | 1032 var clear = true; // Whether to clear previous annotations |
1033 if ('clear' in e.data) { | |
1034 clear = e.data.clear; | |
1035 } | |
1036 | |
1037 app.LoadOsiriXAnnotations(e.data.xml, clear); | |
1696
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1038 } |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1039 else { |
572652803929
bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1693
diff
changeset
|
1040 alert('Unknown type of dynamic action in the Stone Web viewer: ' + e.data.type); |
1613 | 1041 } |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1042 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1043 }); |