annotate Applications/StoneWebViewer/WebApplication/app.js @ 1696:572652803929

bootstrapping the Stone Web viewer configuration file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2020 09:34:02 +0100
parents eafb10992e73
children c2802561d7f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
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
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
34 var globalConfiguration_ = {};
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
35
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 function getParameterFromUrl(key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 var url = window.location.search.substring(1);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 var args = url.split('&');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 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
41 var arg = args[i].split('=');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 if (arg[0] == key) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 return arg[1];
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 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 Vue.component('viewport', {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 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
51 'showInfo' ],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 template: '#viewport-template',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 data: function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 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
56 status: 'waiting',
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
57 currentFrame: 0,
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
58 numberOfFrames: 0,
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
59 quality: '',
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
60 cineControls: false,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
61 cineIncrement: 0,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
62 cineFramesPerSecond: 30,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
63 cineTimeoutId: null,
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
64 cineLoadingFrame: false
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
67 watch: {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
68 currentFrame: function(newVal, oldVal) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
69 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
70 * The "FrameUpdated" event has been received, which indicates
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
71 * 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
72 * proceed to the next frame (check out "CineCallback()").
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
73 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
74 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
75 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 series: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 this.status = 'loading';
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
78 this.cineControls = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
79 this.cineMode = '';
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
80 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
81 this.cineRate = 30; // Default value
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
82
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
83 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
84 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
85 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
86 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 var studyInstanceUid = newVal.tags[STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 var seriesInstanceUid = newVal.tags[SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 stone.SpeedUpFetchSeriesMetadata(studyInstanceUid, seriesInstanceUid);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
91
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 if ((newVal.type == stone.ThumbnailType.IMAGE ||
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 newVal.type == stone.ThumbnailType.NO_PREVIEW) &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 newVal.complete) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 this.status = 'ready';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 var that = this;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 Vue.nextTick(function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 stone.LoadSeriesInViewport(that.canvasId, seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
102 else if (newVal.type == stone.ThumbnailType.PDF) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
103 if (newVal.complete) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
104 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
105 * Series is complete <=> One already knows about the
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
106 * SOPInstanceUIDs that are available in this series. As a
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
107 * consequence,
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
108 * "OrthancStone::SeriesMetadataLoader::Accessor" will not
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
109 * be empty in "ResourcesLoader::FetchPdf()" in C++ code.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
110 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
111 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
112 } else {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
113 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
114 * The SOPInstanceUIDs in this series are not known
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
115 * yet. Schedule an "stone.FetchPdf()" one the series
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
116 * metadata is available.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
117 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
118 pendingSeriesPdf_[seriesInstanceUid] = true;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
119 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
120 }
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
121 else if (newVal.type == stone.ThumbnailType.VIDEO) {
1661
e4589378ad8b warning message about unsupported videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1657
diff changeset
122 this.status = 'video';
e4589378ad8b warning message about unsupported videos
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1657
diff changeset
123 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
124 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 },
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
127 mounted: function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
128 var that = this;
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
129
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
130 window.addEventListener('FrameUpdated', function(args) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
131 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
132 that.currentFrame = (args.detail.currentFrame + 1);
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
133 that.numberOfFrames = args.detail.numberOfFrames;
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
134 that.quality = args.detail.quality;
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
135 }
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
136 });
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
137
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
138 window.addEventListener('SeriesDetailsReady', function(args) {
1673
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
139 if (args.detail.canvasId == that.canvasId) {
dd50f8a1a2be simplifying Vue.js viewport component
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1672
diff changeset
140 that.cineFramesPerSecond = stone.GetCineRate(that.canvasId);
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
141 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
142 });
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
143
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
144 window.addEventListener('PdfLoaded', function(args) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
145 var studyInstanceUid = args.detail.studyInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
146 var seriesInstanceUid = args.detail.seriesInstanceUid;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
147 var pdfPointer = args.detail.pdfPointer;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
148 var pdfSize = args.detail.pdfSize;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
149
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
150 if ('tags' in that.series &&
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
151 that.series.tags[STUDY_INSTANCE_UID] == studyInstanceUid &&
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
152 that.series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
153
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
154 that.status = 'pdf';
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
155 var pdf = new Uint8Array(HEAPU8.subarray(pdfPointer, pdfPointer + pdfSize));
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
156
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
157 /**
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
158 * 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
159 * 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
160 * 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
161 * populated after the component has been rendered", so we
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
162 * wait for the next rendering.
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
163 * 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
164 **/
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
165 Vue.nextTick(function() {
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
166 that.$refs.pdfViewer.LoadPdf(pdf);
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
167 });
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 });
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
170 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 methods: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 SeriesDragAccept: function(event) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 event.preventDefault();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 SeriesDragDrop: function(event) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 event.preventDefault();
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
177
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
178 // The "parseInt()" is because of Microsoft Edge Legacy (*)
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
179 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
180 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 MakeActive: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 this.$emit('selected-viewport');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
184 DecrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
185 return stone.DecrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
186 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
187 IncrementFrame: function(isCircular) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
188 return stone.IncrementFrame(this.canvasId, isCircular);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
189 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
190 CinePlay: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
191 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
192 this.cineIncrement = 1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
193 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
194 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
195 CinePause: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
196 if (this.cineIncrement == 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
197 // 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
198 this.cineControls = !this.cineControls;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
199 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
200 this.cineIncrement = 0;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
201 this.UpdateCine();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
202 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
203 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
204 CineBackward: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
205 this.cineControls = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
206 this.cineIncrement = -1;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
207 this.UpdateCine();
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 },
1672
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
209 UpdateCine: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
210 // Cancel the previous cine loop, if any
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
211 if (this.cineTimeoutId !== null) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
212 clearTimeout(this.cineTimeoutId);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
213 this.cineTimeoutId = null;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
214 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
215
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
216 this.cineLoadingFrame = false;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
217
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
218 if (this.cineIncrement != 0) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
219 this.CineCallback();
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
220 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
221 },
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
222 CineCallback: function() {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
223 var reschedule;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
224
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
225 if (this.cineLoadingFrame) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
226 /**
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
227 * 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
228 * "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
229 * "FrameUpdated" event). Otherwise, the background loading
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
230 * 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
231 * advancement of the current frame, which freezes the
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
232 * display.
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
233 **/
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
234 reschedule = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
235 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
236 this.cineLoadingFrame = true;
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
237
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
238 if (this.cineIncrement == 1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
239 reschedule = this.DecrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
240 } else if (this.cineIncrement == -1) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
241 reschedule = this.IncrementFrame(true /* circular */);
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
242 } else {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
243 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
244 }
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
245 }
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 if (reschedule) {
570398585b5f start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1665
diff changeset
248 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
249 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
1651
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1616
diff changeset
252 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 var app = new Vue({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 el: '#wv',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 data: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 return {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 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
260 ready: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 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
262 leftVisible: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 viewportLayoutButtonsVisible: false,
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
264 mouseActionsVisible: false,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 activeViewport: 0,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 showInfo: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 showReferenceLines: true,
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
268 synchronizedBrowsing: false,
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
269
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
270 modalWarning: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
271 modalNotDiagnostic: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
272 modalPreferences: false,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
273
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
274 // 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
275 settingNotDiagnostic: true,
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
276 settingSoftwareRendering: false,
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
277
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
278 layoutCountX: 1,
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
279 layoutCountY: 1,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 viewport1Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 viewport1Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 viewport1Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 viewport1Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 viewport1Visible: true,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 viewport1Series: {},
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 viewport2Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 viewport2Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 viewport2Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 viewport2Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 viewport2Visible: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 viewport2Series: {},
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 viewport3Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 viewport3Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 viewport3Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 viewport3Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 viewport3Visible: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 viewport3Series: {},
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 viewport4Width: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 viewport4Height: '100%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 viewport4Left: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 viewport4Top: '0%',
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 viewport4Visible: false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 viewport4Series: {},
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
309 showWindowing: false,
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
310 windowingPresets: [],
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
311
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
312 selectedStudies: [],
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 series: [],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 studies: [],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 seriesIndex: {} // Maps "SeriesInstanceUID" to "index in this.series"
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 computed: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 getSelectedStudies() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 var s = '';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 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
322 if (this.studies[i].selected) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 if (s.length > 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 s += ', ';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 s += (this.studies[i].tags[STUDY_DESCRIPTION] + ' [' +
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 this.studies[i].tags[STUDY_DATE] + ']');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 if (s.length == 0)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 return '...';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 else
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 return s;
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 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 watch: {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 leftVisible: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 showReferenceLines: function(newVal, oldVal) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 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
341 },
1693
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
342 synchronizedBrowsing: function(newVal, oldVal) {
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
343 stone.SetSynchronizedBrowsingEnabled(newVal ? 1 : 0);
eafb10992e73 synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1692
diff changeset
344 },
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
345 settingNotDiagnostic: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
346 localStorage.settingNotDiagnostic = (newVal ? '1' : '0');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
347 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
348 settingSoftwareRendering: function(newVal, oldVal) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
349 localStorage.settingSoftwareRendering = (newVal ? '1' : '0');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 methods: {
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
353 FitContent: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 // 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
355 if (typeof stone._AllViewportsUpdateSize !== 'undefined') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 this.$nextTick(function () {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 stone.AllViewportsUpdateSize(true /* fit content */);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
362 GetActiveSeries: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 var s = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 if ('tags' in this.viewport1Series)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 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
367
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 if ('tags' in this.viewport2Series)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 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
370
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 if ('tags' in this.viewport3Series)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 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
373
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 if ('tags' in this.viewport4Series)
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 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
376
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 return s;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
380 GetActiveCanvas: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 if (this.activeViewport == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 else if (this.activeViewport == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 return 'canvas2';
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 else if (this.activeViewport == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 return 'canvas3';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 else if (this.activeViewport == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 return 'canvas4';
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 else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 return 'canvas1';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 }
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
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 SetResources: function(sourceStudies, sourceSeries) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 var indexStudies = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 var posColor = 0;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 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
405 var studyInstanceUid = sourceStudies[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 if (studyInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 console.error('Twice the same study: ' + studyInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 } else {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 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
411
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
412 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
413 this.selectedStudies.includes(studyInstanceUid));
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 studies.push({
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 'studyInstanceUid' : studyInstanceUid,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 'series' : [ ],
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 'color' : COLORS[posColor],
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
419 'selected' : isSelected,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 'tags' : sourceStudies[i]
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 });
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 posColor = (posColor + 1) % COLORS.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 }
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 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 var seriesIndex = {};
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 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
432 var studyInstanceUid = sourceSeries[i][STUDY_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 var seriesInstanceUid = sourceSeries[i][SERIES_INSTANCE_UID];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 if (studyInstanceUid !== undefined &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 seriesInstanceUid !== undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 if (studyInstanceUid in indexStudies) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 seriesIndex[seriesInstanceUid] = series.length;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 var study = studies[indexStudies[studyInstanceUid]];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 study.series.push(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 series.push({
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
441 'numberOfFrames' : 0,
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 'complete' : false,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 'type' : stone.ThumbnailType.LOADING,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 'color': study.color,
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 'tags': sourceSeries[i]
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 });
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 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 }
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 this.studies = studies;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 this.series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 this.seriesIndex = seriesIndex;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 this.ready = true;
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
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 SeriesDragStart: function(event, seriesIndex) {
1547
bf195fc0797e fix for Microsoft Edge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1538
diff changeset
458 // 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
459 event.dataTransfer.setData('seriesIndex', seriesIndex.toString());
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 },
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
461
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
462 SetViewportSeriesInstanceUid: function(viewportIndex, seriesInstanceUid) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
463 if (seriesInstanceUid in this.seriesIndex) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
464 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
465 }
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
466 },
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468 SetViewportSeries: function(viewportIndex, seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 var series = this.series[seriesIndex];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 if (viewportIndex == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 this.viewport1Series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
474 else if (viewportIndex == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 this.viewport2Series = series;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 else if (viewportIndex == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 this.viewport3Series = series;
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 else if (viewportIndex == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 this.viewport4Series = series;
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 ClickSeries: function(seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486 this.SetViewportSeries(this.activeViewport, seriesIndex);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 HideViewport: function(index) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
491 this.viewport1Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
492 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494 this.viewport2Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
497 this.viewport3Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
498 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
500 this.viewport4Visible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 ShowViewport: function(index, left, top, width, height) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
505 if (index == 1) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 this.viewport1Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 this.viewport1Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508 this.viewport1Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 this.viewport1Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 this.viewport1Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 else if (index == 2) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513 this.viewport2Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514 this.viewport2Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 this.viewport2Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 this.viewport2Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 this.viewport2Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
519 else if (index == 3) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
520 this.viewport3Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 this.viewport3Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522 this.viewport3Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 this.viewport3Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 this.viewport3Height = height;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
525 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
526 else if (index == 4) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 this.viewport4Visible = true;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
528 this.viewport4Left = left;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529 this.viewport4Top = top;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 this.viewport4Width = width;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 this.viewport4Height = height;
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 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 SetViewportLayout: function(layout) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 this.viewportLayoutButtonsVisible = false;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537 if (layout == '1x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 this.ShowViewport(1, '0%', '0%', '100%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 this.HideViewport(2);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
542 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
543 this.layoutCountY = 1;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 else if (layout == '2x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 this.ShowViewport(1, '0%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 this.ShowViewport(2, '50%', '0%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 this.ShowViewport(3, '0%', '50%', '50%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 this.ShowViewport(4, '50%', '50%', '50%', '50%');
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
550 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
551 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553 else if (layout == '2x1') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 this.ShowViewport(1, '0%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 this.ShowViewport(2, '50%', '0%', '50%', '100%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
556 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
557 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
558 this.layoutCountX = 2;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
559 this.layoutCountY = 1;
1495
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 else if (layout == '1x2') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 this.ShowViewport(1, '0%', '0%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 this.ShowViewport(2, '0%', '50%', '100%', '50%');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
564 this.HideViewport(3);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 this.HideViewport(4);
1562
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
566 this.layoutCountX = 1;
2a4a6b967053 starting work on print
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1561
diff changeset
567 this.layoutCountY = 2;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 this.FitContent();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573 UpdateSeriesThumbnail: function(seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 var series = this.series[index];
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 var type = stone.LoadSeriesThumbnail(seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 series.type = type;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 if (type == stone.ThumbnailType.IMAGE) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 series.thumbnail = stone.GetStringBuffer();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 }
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 // 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
586 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
587 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
590 UpdateIsSeriesComplete: function(studyInstanceUid, seriesInstanceUid) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 if (seriesInstanceUid in this.seriesIndex) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 var index = this.seriesIndex[seriesInstanceUid];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 var series = this.series[index];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
595 var oldComplete = series.complete;
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
596
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 series.complete = stone.IsSeriesComplete(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
598
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
599 if (!oldComplete &&
1674
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
600 series.complete)
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
601 {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
602 series.numberOfFrames = stone.GetSeriesNumberOfFrames(seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
603
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
604 if (seriesInstanceUid in pendingSeriesPdf_) {
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
605 stone.FetchPdf(studyInstanceUid, seriesInstanceUid);
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
606 delete pendingSeriesPdf_[seriesInstanceUid];
0621e523b670 number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1673
diff changeset
607 }
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
608 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 // 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
611 this.$set(this.series, index, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 if ('tags' in this.viewport1Series &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 this.viewport1Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 this.$set(this.viewport1Series, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 if ('tags' in this.viewport2Series &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 this.viewport2Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 this.$set(this.viewport2Series, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 if ('tags' in this.viewport3Series &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 this.viewport3Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 this.$set(this.viewport3Series, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 if ('tags' in this.viewport4Series &&
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 this.viewport4Series.tags[SERIES_INSTANCE_UID] == seriesInstanceUid) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 this.$set(this.viewport4Series, series);
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 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
635 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
636 this.showWindowing = false;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 stone.SetWindowing(canvas, center, width);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
643 InvertContrast: function() {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 var canvas = this.GetActiveCanvas();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645 if (canvas != '') {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 stone.InvertContrast(canvas);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 }
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
648 },
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
649
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
650 FlipX: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
651 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
652 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
653 stone.FlipX(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
654 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
655 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
656
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
657 FlipY: function() {
1554
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
658 var canvas = this.GetActiveCanvas();
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
659 if (canvas != '') {
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
660 stone.FlipY(canvas);
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
661 }
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
662 },
6d14ed6163b1 flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1552
diff changeset
663
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
664 ApplyPreferences: function() {
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
665 this.modalPreferences = false;
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
666
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
667 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
668 document.location.reload();
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
669 }
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
670 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
671
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
672 HideAllTooltips: function() {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
673 $('[data-toggle="tooltip"]').tooltip('hide');
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
674 },
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
675
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
676 SetMouseButtonActions: function(left, middle, right) {
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
677 this.mouseActionsVisible = false;
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
678 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
679 },
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
680
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
681 LoadOsiriXAnnotations: function(xml, clearPrevious)
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
682 {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
683 if (stone.LoadOsiriXAnnotations(xml, clearPrevious)) {
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
684 var seriesInstanceUid = stone.GetStringBuffer();
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
685
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
686 this.SetViewportLayout('1x1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
687 this.leftVisible = false;
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
688 this.SetViewportSeriesInstanceUid(1, seriesInstanceUid);
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
689
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
690 stone.FocusFirstOsiriXAnnotation('canvas1');
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
691 }
1681
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
692 },
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
693
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
694 ToggleWindowing: function()
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
695 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
696 if (this.showWindowing)
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
697 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
698 this.showWindowing = false;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
699 }
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
700 else
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
701 {
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
702 stone.LoadWindowingPresets(this.GetActiveCanvas());
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
703 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
704
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
705 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
706 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
707 $('#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
708 //$('#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
709 //$('#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
710
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
711 this.showWindowing = true;
f2e8b3ac1dcd handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1677
diff changeset
712 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
713 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 },
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 mounted: function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 this.SetViewportLayout('1x1');
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
718
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
719 if (localStorage.settingNotDiagnostic) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
720 this.settingNotDiagnostic = (localStorage.settingNotDiagnostic == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
721 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
722
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
723 if (localStorage.settingSoftwareRendering) {
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
724 this.settingSoftwareRendering = (localStorage.settingSoftwareRendering == '1');
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
725 }
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
726
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
727 this.modalNotDiagnostic = this.settingNotDiagnostic;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 window.addEventListener('StoneInitialized', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 stone.Setup(Module);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 stone.SetOrthancRoot('..', true);
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
736 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
737 console.warn('Stone properly initialized');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
739 var selectedStudies = getParameterFromUrl('selectedStudies');
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 var study = getParameterFromUrl('study');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 var series = getParameterFromUrl('series');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742
1692
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
743 if (selectedStudies !== undefined) {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
744 app.selectedStudies = selectedStudies.split(',');
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
745 } else {
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
746 app.selectedStudies = [];
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
747 }
e787b52d025f "selectedStudies" argument to replace "selectedStudyIds" from Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1691
diff changeset
748
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 if (study === undefined) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750 alert('No study was provided in the URL!');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 } else {
1691
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
752 var studies = study.split(',');
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
753 if (studies.length > 1) {
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
754 for (var i = 0; i < studies.length; i++) {
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
755 console.warn('Loading study: ' + studies[i]);
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
756 stone.FetchStudy(studies[i]);
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
757 }
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
758 } else if (series === undefined) {
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 console.warn('Loading study: ' + study);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 stone.FetchStudy(study);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761 } else {
1691
4a49de03a419 porting the "pickableStudyIds" feature of Osimis Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1681
diff changeset
762 console.warn('Loading series: ' + series + ' from study: ' + study);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 stone.FetchSeries(study, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 app.leftMode = 'full';
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 window.addEventListener('ResourcesLoaded', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 console.log('resources loaded');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 var studies = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 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
775 stone.LoadStudyTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 studies.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 var series = [];
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 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
781 stone.LoadSeriesTags(i);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 series.push(JSON.parse(stone.GetStringBuffer()));
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 app.SetResources(studies, series);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
787 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
788 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
789 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
790 app.UpdateSeriesThumbnail(seriesInstanceUid);
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
791 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 }
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 window.addEventListener('ThumbnailLoaded', function(args) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 //var studyInstanceUid = args.detail.studyInstanceUid;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798 var seriesInstanceUid = args.detail.seriesInstanceUid;
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 app.UpdateSeriesThumbnail(seriesInstanceUid);
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
801
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 window.addEventListener('MetadataLoaded', function(args) {
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
804 var studyInstanceUid = args.detail.studyInstanceUid;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 var seriesInstanceUid = args.detail.seriesInstanceUid;
1657
66e5fcdf5597 pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1651
diff changeset
806 app.UpdateIsSeriesComplete(studyInstanceUid, seriesInstanceUid);
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 window.addEventListener('StoneException', function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 console.error('Exception catched in Stone');
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
812 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
816
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
817 function ParseJsonWithComments(json)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
818 {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
819 if (typeof(json) == 'string') {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
820 // https://stackoverflow.com/a/62945875/881731
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
821 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
822 (m, g) => g ? "" : m));
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
823 } else {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
824 return json;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
825 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
826 }
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829 $(document).ready(function() {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 // Enable support for tooltips in Bootstrap
1561
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
831 $('[data-toggle="tooltip"]').tooltip({
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
832 placement: 'bottom',
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
833 container: 'body',
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
834 trigger: 'hover'
cf652990abb1 tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1554
diff changeset
835 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836
1552
a4d82f1bcb10 user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1547
diff changeset
837 //app.modalWarning = true;
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
839 axios.get(CONFIGURATION_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
840 .then(function(response) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
841 globalConfiguration_ = ParseJsonWithComments(response.data);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
842
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
843 // 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
844
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
845 /*
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
846 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
847 script.src = WASM_SOURCE;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
848 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
849 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
850 */
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
852 // 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
853 // explicitly report errors)
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
855 axios.get(WASM_SOURCE)
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
856 .then(function (response) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
857 var script = document.createElement('script');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
858 script.innerHTML = response.data;
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
859 script.type = 'text/javascript';
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
860 document.body.appendChild(script);
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
861 })
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
862 .catch(function (error) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
863 alert('Cannot load the WebAssembly framework');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
864 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 })
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866 .catch(function (error) {
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
867 alert('Cannot load the configuration file');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
868 });
1495
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 // "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
873 // studies: https://stackoverflow.com/questions/26639346
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
874 $('.dropdown-menu').click(function(e) {
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875 e.stopPropagation();
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 });
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878
fb74ed5d8c22 initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 // 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
880 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
881
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
882
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
883 window.addEventListener('message', function(e) {
1613
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
884 if ('type' in e.data) {
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
885 var expectedOrigin = globalConfiguration_['ExpectedMessageOrigin'];
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
886
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
887 if (expectedOrigin === undefined) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
888 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
889 'set the configuration option "ExpectedMessageOrigin".');
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
890 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
891 else if (expectedOrigin != '*' &&
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
892 e.origin !== expectedOrigin) {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
893 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
894 '", whereas the message must have origin: "' + expectedOrigin + '"');
1611
787db80a5a1b new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1603
diff changeset
895 }
1696
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
896 else if (e.data.type == 'show-osirix-annotations') {
1613
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
897 var clear = true; // Whether to clear previous annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
898 if ('clear' in e.data) {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
899 clear = e.data.clear;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
900 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
901
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
902 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
903 }
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
904 else {
572652803929 bootstrapping the Stone Web viewer configuration file
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1693
diff changeset
905 alert('Unknown type of dynamic action in the Stone Web viewer: ' + e.data.type);
1613
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1611
diff changeset
906 }
1603
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
907 }
595c0952ef7e focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
908 });