Mercurial > hg > orthanc-stone
annotate Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1964:2034ae383cfd deep-learning
integration default->deep-learning
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Oct 2022 07:47:55 +0200 |
parents | 0661115af939 79fdc3b1f031 |
children | 963f28eb40cb |
rev | line source |
---|---|
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
17 * |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
23 #include <EmbeddedResources.h> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include <emscripten.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #define DISPATCH_JAVASCRIPT_EVENT(name) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 EM_ASM( \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 const customEvent = document.createEvent("CustomEvent"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 customEvent.initCustomEvent(name, false, false, undefined); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 window.dispatchEvent(customEvent); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 ); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #define EXTERN_CATCH_EXCEPTIONS \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 catch (Orthanc::OrthancException& e) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 LOG(ERROR) << "OrthancException: " << e.What(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 } \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 catch (OrthancStone::StoneException& e) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 LOG(ERROR) << "StoneException: " << e.What(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
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 catch (std::exception& e) \ |
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 LOG(ERROR) << "Runtime error: " << e.what(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 } \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 catch (...) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 LOG(ERROR) << "Native exception"; \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
58 // Orthanc framework includes |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 #include <Cache/MemoryObjectCache.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 #include <DicomFormat/DicomArray.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
61 #include <DicomParsing/ParsedDicomFile.h> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 #include <Images/Image.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 #include <Images/ImageProcessing.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 #include <Images/JpegReader.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 #include <Logging.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
67 // Stone includes |
1902 | 68 #include "../../../OrthancStone/Sources/Loaders/DicomResourcesLoader.h" |
69 #include "../../../OrthancStone/Sources/Loaders/SeriesMetadataLoader.h" | |
70 #include "../../../OrthancStone/Sources/Loaders/SeriesThumbnailsLoader.h" | |
71 #include "../../../OrthancStone/Sources/Messages/ObserverBase.h" | |
72 #include "../../../OrthancStone/Sources/Oracle/ParseDicomFromWadoCommand.h" | |
73 #include "../../../OrthancStone/Sources/Oracle/ParseDicomSuccessMessage.h" | |
74 #include "../../../OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h" | |
75 #include "../../../OrthancStone/Sources/Scene2D/ArrowSceneLayer.h" | |
76 #include "../../../OrthancStone/Sources/Scene2D/ColorTextureSceneLayer.h" | |
77 #include "../../../OrthancStone/Sources/Scene2D/FloatTextureSceneLayer.h" | |
78 #include "../../../OrthancStone/Sources/Scene2D/MacroSceneLayer.h" | |
79 #include "../../../OrthancStone/Sources/Scene2D/OsiriXLayerFactory.h" | |
80 #include "../../../OrthancStone/Sources/Scene2D/PolylineSceneLayer.h" | |
81 #include "../../../OrthancStone/Sources/Scene2D/TextSceneLayer.h" | |
82 #include "../../../OrthancStone/Sources/Scene2DViewport/ViewportController.h" | |
83 #include "../../../OrthancStone/Sources/StoneException.h" | |
84 #include "../../../OrthancStone/Sources/Toolbox/DicomInstanceParameters.h" | |
85 #include "../../../OrthancStone/Sources/Toolbox/GeometryToolbox.h" | |
86 #include "../../../OrthancStone/Sources/Toolbox/OsiriX/AngleAnnotation.h" | |
87 #include "../../../OrthancStone/Sources/Toolbox/OsiriX/CollectionOfAnnotations.h" | |
88 #include "../../../OrthancStone/Sources/Toolbox/OsiriX/LineAnnotation.h" | |
89 #include "../../../OrthancStone/Sources/Toolbox/OsiriX/TextAnnotation.h" | |
90 #include "../../../OrthancStone/Sources/Toolbox/SortedFrames.h" | |
91 #include "../../../OrthancStone/Sources/Viewport/DefaultViewportInteractor.h" | |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
92 |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
93 // WebAssembly includes |
1902 | 94 #include "../../../OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyCairoViewport.h" |
95 #include "../../../OrthancStone/Sources/Platforms/WebAssembly/WebAssemblyLoadersContext.h" | |
96 #include "../../../OrthancStone/Sources/Platforms/WebAssembly/WebGLViewport.h" | |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
97 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
99 #include <boost/math/special_functions/round.hpp> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 #include <boost/make_shared.hpp> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 #include <stdio.h> |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
102 #include <algorithm> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
104 #if !defined(STONE_WEB_VIEWER_EXPORT) |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
105 // We are not running ParseWebAssemblyExports.py, but we're compiling the wasm |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
106 # define STONE_WEB_VIEWER_EXPORT |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
107 #endif |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
108 |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
109 |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
110 #define FIX_LSD_479 1 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
111 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
112 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
113 enum STONE_WEB_VIEWER_EXPORT ThumbnailType |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 ThumbnailType_Image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 ThumbnailType_NoPreview, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 ThumbnailType_Pdf, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 ThumbnailType_Video, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 ThumbnailType_Loading, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 ThumbnailType_Unknown |
1668 | 121 }; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
124 enum STONE_WEB_VIEWER_EXPORT DisplayedFrameQuality |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 { |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
126 DisplayedFrameQuality_None, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
127 DisplayedFrameQuality_Low, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
128 DisplayedFrameQuality_High |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
129 }; |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
130 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
131 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
132 enum STONE_WEB_VIEWER_EXPORT WebViewerAction |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
133 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
134 WebViewerAction_None, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
135 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
136 WebViewerAction_Windowing, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
137 WebViewerAction_Zoom, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
138 WebViewerAction_Pan, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
139 WebViewerAction_Rotate, |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
140 WebViewerAction_Crosshair, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
141 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
142 WebViewerAction_CreateAngle, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
143 WebViewerAction_CreateCircle, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
144 WebViewerAction_CreateSegment, |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
145 WebViewerAction_RemoveMeasure |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
146 }; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
150 static OrthancStone::MouseAction ConvertWebViewerAction(int action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
151 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
152 switch (action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
153 { |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
154 case WebViewerAction_Windowing: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
155 return OrthancStone::MouseAction_GrayscaleWindowing; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
156 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
157 case WebViewerAction_Zoom: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
158 return OrthancStone::MouseAction_Zoom; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
159 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
160 case WebViewerAction_Pan: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
161 return OrthancStone::MouseAction_Pan; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
162 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
163 case WebViewerAction_Rotate: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
164 return OrthancStone::MouseAction_Rotate; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
165 |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
166 case WebViewerAction_None: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
167 case WebViewerAction_Crosshair: |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
168 case WebViewerAction_CreateAngle: |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
169 case WebViewerAction_CreateCircle: |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
170 case WebViewerAction_CreateSegment: |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
171 case WebViewerAction_RemoveMeasure: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
172 return OrthancStone::MouseAction_None; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
173 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
174 default: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
175 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
176 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
177 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
178 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
179 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
180 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 static const int PRIORITY_HIGH = -100; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 static const int PRIORITY_LOW = 100; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 static const int PRIORITY_NORMAL = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 static const unsigned int QUALITY_JPEG = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 static const unsigned int QUALITY_FULL = 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
188 static const unsigned int DEFAULT_CINE_RATE = 30; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
189 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
190 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
191 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
192 class VirtualSeries : public boost::noncopyable |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
193 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
194 private: |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
195 class Item : public boost::noncopyable |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
196 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
197 private: |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
198 std::string seriesInstanceUid_; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
199 std::list<std::string> sopInstanceUids_; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
200 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
201 public: |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
202 Item(const std::string& seriesInstanceUid, |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
203 const std::list<std::string>& sopInstanceUids) : |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
204 seriesInstanceUid_(seriesInstanceUid), |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
205 sopInstanceUids_(sopInstanceUids) |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
206 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
207 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
208 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
209 const std::string& GetSeriesInstanceUid() const |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
210 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
211 return seriesInstanceUid_; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
212 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
213 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
214 const std::list<std::string>& GetSopInstanceUids() const |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
215 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
216 return sopInstanceUids_; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
217 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
218 }; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
219 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
220 typedef std::map<std::string, Item*> Content; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
221 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
222 Content content_; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
223 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
224 const Item& GetItem(const std::string& id) const |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
225 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
226 Content::const_iterator found = content_.find(id); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
227 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
228 if (found == content_.end()) |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
229 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
230 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
231 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
232 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
233 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
234 assert(found->second != NULL); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
235 return *found->second; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
236 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
237 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
238 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
239 public: |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
240 ~VirtualSeries() |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
241 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
242 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
243 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
244 assert(it->second != NULL); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
245 delete it->second; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
246 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
247 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
248 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
249 std::string AddSingleInstance(const std::string& seriesInstanceUid, |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
250 const std::string& sopInstanceUid) |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
251 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
252 std::list<std::string> sopInstanceUids; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
253 sopInstanceUids.push_back(sopInstanceUid); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
254 return AddMultipleInstances(seriesInstanceUid, sopInstanceUids); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
255 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
256 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
257 std::string AddMultipleInstances(const std::string& seriesInstanceUid, |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
258 const std::list<std::string>& sopInstanceUids) |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
259 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
260 // Generate a unique identifier for this virtual series |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
261 const std::string virtualSeriesId = "virtual-" + boost::lexical_cast<std::string>(content_.size()); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
262 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
263 if (content_.find(virtualSeriesId) != content_.end()) |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
264 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
265 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
266 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
267 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
268 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
269 content_.insert(std::make_pair(virtualSeriesId, new Item(seriesInstanceUid, sopInstanceUids))); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
270 return virtualSeriesId; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
271 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
272 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
273 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
274 const std::string& GetSeriesInstanceUid(const std::string& id) const |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
275 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
276 return GetItem(id).GetSeriesInstanceUid(); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
277 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
278 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
279 const std::list<std::string>& GetSopInstanceUids(const std::string& id) const |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
280 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
281 return GetItem(id).GetSopInstanceUids(); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
282 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
283 }; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
284 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
285 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
286 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 class ResourcesLoader : public OrthancStone::ObserverBase<ResourcesLoader> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 class IObserver : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 virtual ~IObserver() |
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 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 virtual void SignalResourcesLoaded() = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 virtual void SignalSeriesThumbnailLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 const std::string& seriesInstanceUid) = 0; |
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 virtual void SignalSeriesMetadataLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 const std::string& seriesInstanceUid) = 0; |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
304 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
305 virtual void SignalSeriesPdfLoaded(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
306 const std::string& seriesInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
307 const std::string& pdf) = 0; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
308 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
309 virtual void SignalVirtualSeriesThumbnailLoaded(const std::string& virtualSeriesId, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
310 const std::string& jpeg) = 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 private: |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
314 OrthancStone::ILoadersContext& context_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 std::unique_ptr<IObserver> observer_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 OrthancStone::DicomSource source_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 size_t pending_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 boost::shared_ptr<OrthancStone::LoadedDicomResources> studies_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 boost::shared_ptr<OrthancStone::LoadedDicomResources> series_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 boost::shared_ptr<OrthancStone::DicomResourcesLoader> resourcesLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 boost::shared_ptr<OrthancStone::SeriesThumbnailsLoader> thumbnailsLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 boost::shared_ptr<OrthancStone::SeriesMetadataLoader> metadataLoader_; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
323 std::set<std::string> scheduledVirtualSeriesThumbnails_; |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
324 VirtualSeries virtualSeries_; |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
325 std::vector<std::string> skipSeriesFromModalities_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
327 explicit ResourcesLoader(OrthancStone::ILoadersContext& context, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
328 const OrthancStone::DicomSource& source) : |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
329 context_(context), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 source_(source), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 pending_(0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 studies_(new OrthancStone::LoadedDicomResources(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID)), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 series_(new OrthancStone::LoadedDicomResources(Orthanc::DICOM_TAG_SERIES_INSTANCE_UID)) |
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 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) |
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 const Orthanc::SingleValueObject<Orthanc::ResourceType>& payload = |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 dynamic_cast<const Orthanc::SingleValueObject<Orthanc::ResourceType>&>(message.GetUserPayload()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 OrthancStone::LoadedDicomResources& dicom = *message.GetResources(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 LOG(INFO) << "resources loaded: " << dicom.GetSize() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 << ", " << Orthanc::EnumerationToString(payload.GetValue()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
347 std::vector<std::string> seriesIdsToRemove; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
348 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 if (payload.GetValue() == Orthanc::ResourceType_Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 { |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
351 // the 'dicom' var is actually equivalent to the 'series_' member in this case |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
352 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 for (size_t i = 0; i < dicom.GetSize(); i++) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 { |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
355 std::string studyInstanceUid, seriesInstanceUid, modality; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 if (dicom.GetResource(i).LookupStringValue( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 studyInstanceUid, Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, false) && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 dicom.GetResource(i).LookupStringValue( |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
359 seriesInstanceUid, Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, false) && |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
360 dicom.GetResource(i).LookupStringValue( |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
361 modality, Orthanc::DICOM_TAG_MODALITY, false)) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 { |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
363 // skip series that should not be displayed |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
364 if (std::find(skipSeriesFromModalities_.begin(), skipSeriesFromModalities_.end(), modality) == skipSeriesFromModalities_.end()) |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
365 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
366 thumbnailsLoader_->ScheduleLoadThumbnail(source_, "", studyInstanceUid, seriesInstanceUid); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
367 metadataLoader_->ScheduleLoadSeries(PRIORITY_LOW + 1, source_, studyInstanceUid, seriesInstanceUid); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
368 } |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
369 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
370 else |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
371 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
372 seriesIdsToRemove.push_back(seriesInstanceUid); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
373 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 } |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
376 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
377 for (size_t i = 0; i < seriesIdsToRemove.size(); i++) |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
378 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
379 LOG(INFO) << "series to hide: " << seriesIdsToRemove[i]; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
380 dicom.RemoveResource(seriesIdsToRemove[i]); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
381 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 } |
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 if (pending_ == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 else |
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 pending_ --; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 if (pending_ == 0 && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 observer_->SignalResourcesLoaded(); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 void Handle(const OrthancStone::SeriesThumbnailsLoader::SuccessMessage& message) |
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 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
402 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
403 observer_->SignalSeriesThumbnailLoaded( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
404 message.GetStudyInstanceUid(), message.GetSeriesInstanceUid()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
405 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
406 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
407 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
408 void Handle(const OrthancStone::SeriesMetadataLoader::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
409 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 observer_->SignalSeriesMetadataLoaded( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 message.GetStudyInstanceUid(), message.GetSeriesInstanceUid()); |
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 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
416 |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
417 void FetchInternal(const std::string& patientId, |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
418 const std::string& studyInstanceUid, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 const std::string& seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 // Firstly, load the study |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 Orthanc::DicomMap filter; |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
423 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
424 if (!patientId.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
425 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
426 filter.SetValue(Orthanc::DICOM_TAG_PATIENT_ID, patientId, false); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
427 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
428 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
429 if (!studyInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
430 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
431 filter.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, studyInstanceUid, false); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
432 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
433 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 std::set<Orthanc::DicomTag> tags; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 tags.insert(Orthanc::DICOM_TAG_STUDY_DESCRIPTION); // Necessary for Orthanc DICOMweb plugin |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 resourcesLoader_->ScheduleQido( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 studies_, PRIORITY_HIGH, source_, Orthanc::ResourceType_Study, filter, tags, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 new Orthanc::SingleValueObject<Orthanc::ResourceType>(Orthanc::ResourceType_Study)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 // Secondly, load the series |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 if (!seriesInstanceUid.empty()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
443 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
444 filter.SetValue(Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, seriesInstanceUid, false); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 } |
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 tags.insert(Orthanc::DICOM_TAG_SERIES_NUMBER); // Necessary for Google Cloud Platform |
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 resourcesLoader_->ScheduleQido( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 series_, PRIORITY_HIGH, source_, Orthanc::ResourceType_Series, filter, tags, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 new Orthanc::SingleValueObject<Orthanc::ResourceType>(Orthanc::ResourceType_Series)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 pending_ += 2; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 } |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
455 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
456 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
457 class PdfInfo : public Orthanc::IDynamicObject |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
458 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
459 private: |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
460 std::string studyInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
461 std::string seriesInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
462 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
463 public: |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
464 PdfInfo(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
465 const std::string& seriesInstanceUid) : |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
466 studyInstanceUid_(studyInstanceUid), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
467 seriesInstanceUid_(seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
468 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
469 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
470 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
471 const std::string& GetStudyInstanceUid() const |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
472 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
473 return studyInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
474 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
475 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
476 const std::string& GetSeriesInstanceUid() const |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
477 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
478 return seriesInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
479 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
480 }; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
481 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
482 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
483 void Handle(const OrthancStone::ParseDicomSuccessMessage& message) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
484 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
485 const PdfInfo& info = dynamic_cast<const PdfInfo&>(message.GetOrigin().GetPayload()); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
486 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
487 if (observer_.get() != NULL) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
488 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
489 std::string pdf; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
490 if (message.GetDicom().ExtractPdf(pdf)) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
491 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
492 observer_->SignalSeriesPdfLoaded(info.GetStudyInstanceUid(), info.GetSeriesInstanceUid(), pdf); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
493 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
494 else |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
495 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
496 LOG(ERROR) << "Unable to extract PDF from series: " << info.GetSeriesInstanceUid(); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
497 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
498 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
499 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
500 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
501 void FetchVirtualSeriesThumbnail(const std::string& virtualSeriesId, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
502 const std::string& studyInstanceUid, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
503 const std::string& seriesInstanceUid, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
504 const std::string& sopInstanceUid) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
505 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
506 if (scheduledVirtualSeriesThumbnails_.find(virtualSeriesId) == scheduledVirtualSeriesThumbnails_.end()) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
507 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
508 scheduledVirtualSeriesThumbnails_.insert(virtualSeriesId); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
509 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
510 std::map<std::string, std::string> arguments; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
511 std::map<std::string, std::string> headers; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
512 arguments["viewport"] = ( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
513 boost::lexical_cast<std::string>(thumbnailsLoader_->GetThumbnailWidth()) + "," + |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
514 boost::lexical_cast<std::string>(thumbnailsLoader_->GetThumbnailHeight())); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
515 headers["Accept"] = Orthanc::MIME_JPEG; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
516 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
517 const std::string uri = ("studies/" + studyInstanceUid + "/series/" + seriesInstanceUid + |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
518 "/instances/" + sopInstanceUid + "/frames/1/rendered"); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
519 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
520 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
521 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock()); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
522 lock->Schedule( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
523 GetSharedObserver(), PRIORITY_LOW + 2, source_.CreateDicomWebCommand( |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
524 uri, arguments, headers, new Orthanc::SingleValueObject<std::string>(virtualSeriesId))); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
525 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
526 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
527 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
528 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
529 void HandleInstanceThumbnail(const OrthancStone::HttpCommand::SuccessMessage& message) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
530 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
531 if (observer_.get() != NULL) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
532 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
533 const std::string& virtualSeriesId = |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
534 dynamic_cast<const Orthanc::SingleValueObject<std::string>&>( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
535 message.GetOrigin().GetPayload()).GetValue(); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
536 observer_->SignalVirtualSeriesThumbnailLoaded(virtualSeriesId, message.GetAnswer()); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
537 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
538 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
539 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 public: |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
541 void SetSkipSeriesFromModalities(const std::vector<std::string>& skipSeriesFromModalities) |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
542 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
543 skipSeriesFromModalities_ = skipSeriesFromModalities; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
544 } |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
545 |
1916 | 546 static boost::shared_ptr<ResourcesLoader> Create(const OrthancStone::ILoadersContext::ILock& lock, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 const OrthancStone::DicomSource& source) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 { |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
549 boost::shared_ptr<ResourcesLoader> loader(new ResourcesLoader(lock.GetContext(), source)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
550 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
551 loader->resourcesLoader_ = OrthancStone::DicomResourcesLoader::Create(lock); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
552 loader->thumbnailsLoader_ = OrthancStone::SeriesThumbnailsLoader::Create(lock, PRIORITY_LOW); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
553 loader->metadataLoader_ = OrthancStone::SeriesMetadataLoader::Create(lock); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
554 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
555 loader->Register<OrthancStone::DicomResourcesLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 *loader->resourcesLoader_, &ResourcesLoader::Handle); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
558 loader->Register<OrthancStone::SeriesThumbnailsLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 *loader->thumbnailsLoader_, &ResourcesLoader::Handle); |
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 loader->Register<OrthancStone::SeriesMetadataLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 *loader->metadataLoader_, &ResourcesLoader::Handle); |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
563 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
564 loader->Register<OrthancStone::ParseDicomSuccessMessage>( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
565 lock.GetOracleObservable(), &ResourcesLoader::Handle); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
566 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
567 loader->Register<OrthancStone::HttpCommand::SuccessMessage>( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
568 lock.GetOracleObservable(), &ResourcesLoader::HandleInstanceThumbnail); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
569 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
570 return loader; |
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 void FetchAllStudies() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
575 FetchInternal("", "", ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
576 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
577 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
578 void FetchPatient(const std::string& patientId) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
579 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
580 if (!patientId.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
581 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
582 FetchInternal(patientId, "", ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
583 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
584 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
585 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
586 void FetchStudy(const std::string& studyInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
587 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
588 if (!studyInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
589 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
590 FetchInternal("", studyInstanceUid, ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
591 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
593 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 void FetchSeries(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 const std::string& seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
597 if (!studyInstanceUid.empty() && |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
598 !seriesInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
599 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
600 FetchInternal("", studyInstanceUid, seriesInstanceUid); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
601 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
603 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
604 size_t GetStudiesCount() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
605 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
606 return studies_->GetSize(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
608 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 size_t GetSeriesCount() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 return series_->GetSize(); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 void GetStudy(Orthanc::DicomMap& target, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
615 size_t i) const |
1495
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 target.Assign(studies_->GetResource(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
618 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
619 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
620 void GetSeries(Orthanc::DicomMap& target, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
621 size_t i) const |
1495
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 target.Assign(series_->GetResource(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
624 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
625 // Complement with the study-level tags |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
626 std::string studyInstanceUid; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
627 if (target.LookupStringValue(studyInstanceUid, Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, false) && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
628 studies_->HasResource(studyInstanceUid)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
629 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
630 studies_->MergeResource(target, studyInstanceUid); |
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 OrthancStone::SeriesThumbnailType GetSeriesThumbnail(std::string& image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
635 std::string& mime, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
636 const std::string& seriesInstanceUid) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
637 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
638 return thumbnailsLoader_->GetSeriesThumbnail(image, mime, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
639 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
640 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 void FetchSeriesMetadata(int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 const std::string& studyInstanceUid, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
643 const std::string& seriesInstanceUid) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
644 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
645 metadataLoader_->ScheduleLoadSeries(priority, source_, studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
646 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
647 |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
648 bool IsSeriesComplete(const std::string& seriesInstanceUid) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
649 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
650 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
651 return accessor.IsComplete(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
652 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
653 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
654 bool LookupVirtualSeries(std::map<std::string, unsigned int>& virtualSeries /* out */, |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
655 const std::string& seriesInstanceUid) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
656 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
657 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
658 if (accessor.IsComplete() && |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
659 accessor.GetInstancesCount() >= 2) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
660 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
661 bool hasMultiframe = false; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
662 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
663 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
664 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
665 OrthancStone::DicomInstanceParameters p(accessor.GetInstance(i)); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
666 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
667 if (p.GetNumberOfFrames() > 1) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
668 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
669 hasMultiframe = true; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
670 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
671 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
672 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
673 if (hasMultiframe) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
674 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
675 std::string studyInstanceUid; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
676 std::list<std::string> instancesWithoutFrameNumber; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
677 |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
678 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
679 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
680 OrthancStone::DicomInstanceParameters p(accessor.GetInstance(i)); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
681 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
682 if (p.HasNumberOfFrames()) |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
683 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
684 const std::string virtualSeriesId = virtualSeries_.AddSingleInstance(seriesInstanceUid, p.GetSopInstanceUid()); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
685 if (virtualSeries.find(virtualSeriesId) != virtualSeries.end()) |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
686 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
687 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
688 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
689 else |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
690 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
691 virtualSeries[virtualSeriesId] = p.GetNumberOfFrames(); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
692 FetchVirtualSeriesThumbnail(virtualSeriesId, p.GetStudyInstanceUid(), seriesInstanceUid, p.GetSopInstanceUid()); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
693 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
694 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
695 else |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
696 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
697 studyInstanceUid = p.GetStudyInstanceUid(); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
698 instancesWithoutFrameNumber.push_back(p.GetSopInstanceUid()); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
699 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
700 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
701 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
702 if (!instancesWithoutFrameNumber.empty()) |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
703 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
704 /** |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
705 * Group together in a single "virtual series" all the DICOM |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
706 * instances that have no value for the tag "NumberOfFrames" |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
707 * (0028,0008). This can happen in US CINE series. New in |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
708 * Stone Web viewer 2.1. |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
709 * https://groups.google.com/g/orthanc-users/c/V-vOnlwj06A/m/2sPNwteYAAAJ |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
710 **/ |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
711 const std::string virtualSeriesId = virtualSeries_.AddMultipleInstances(seriesInstanceUid, instancesWithoutFrameNumber); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
712 virtualSeries[virtualSeriesId] = instancesWithoutFrameNumber.size(); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
713 FetchVirtualSeriesThumbnail(virtualSeriesId, studyInstanceUid, seriesInstanceUid, instancesWithoutFrameNumber.front()); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
714 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
715 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
716 return true; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
717 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
718 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
719 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
720 return false; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
721 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
722 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
723 else |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
724 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
725 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
726 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
727 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
728 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
729 bool SortSeriesFrames(OrthancStone::SortedFrames& target, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
730 const std::string& seriesInstanceUid) const |
1495
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 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
733 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
734 if (accessor.IsComplete()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
735 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
736 target.Clear(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
737 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
738 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
739 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
740 target.AddInstance(accessor.GetInstance(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
741 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
742 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
743 target.Sort(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
744 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
745 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
746 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
747 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
748 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
749 return false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
750 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
751 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
752 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
753 bool SortVirtualSeriesFrames(OrthancStone::SortedFrames& target, |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
754 const std::string& virtualSeriesId) const |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
755 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
756 const std::string& seriesInstanceUid = virtualSeries_.GetSeriesInstanceUid(virtualSeriesId); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
757 |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
758 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
759 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
760 if (accessor.IsComplete()) |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
761 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
762 const std::list<std::string>& sopInstanceUids = virtualSeries_.GetSopInstanceUids(virtualSeriesId); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
763 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
764 target.Clear(); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
765 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
766 for (std::list<std::string>::const_iterator |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
767 it = sopInstanceUids.begin(); it != sopInstanceUids.end(); ++it) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
768 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
769 Orthanc::DicomMap instance; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
770 if (accessor.LookupInstance(instance, *it)) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
771 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
772 target.AddInstance(instance); |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
773 } |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
774 else |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
775 { |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
776 LOG(ERROR) << "Missing instance: " << *it; |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
777 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
778 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
779 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
780 target.Sort(); |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
781 return true; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
782 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
783 else |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
784 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
785 return false; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
786 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
787 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
788 |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
789 size_t GetSeriesNumberOfFrames(const std::string& seriesInstanceUid) const |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
790 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
791 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
792 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
793 if (accessor.IsComplete()) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
794 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
795 size_t count = 0; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
796 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
797 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
798 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
799 uint32_t f; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
800 if (accessor.GetInstance(i).ParseUnsignedInteger32(f, Orthanc::DICOM_TAG_NUMBER_OF_FRAMES)) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
801 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
802 count += f; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
803 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
804 else |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
805 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
806 count++; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
807 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
808 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
809 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
810 return count; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
811 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
812 else |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
813 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
814 return 0; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
815 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
816 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
817 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
818 void AcquireObserver(IObserver* observer) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
819 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
820 observer_.reset(observer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
821 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
822 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
823 void FetchPdf(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
824 const std::string& seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
825 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
826 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
827 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
828 if (accessor.IsComplete()) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
829 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
830 if (accessor.GetInstancesCount() > 1) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
831 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
832 LOG(INFO) << "Series with more than one instance, will show the first PDF: " |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
833 << seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
834 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
835 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
836 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
837 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
838 std::string sopClassUid, sopInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
839 if (accessor.GetInstance(i).LookupStringValue(sopClassUid, Orthanc::DICOM_TAG_SOP_CLASS_UID, false) && |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
840 accessor.GetInstance(i).LookupStringValue(sopInstanceUid, Orthanc::DICOM_TAG_SOP_INSTANCE_UID, false) && |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
841 sopClassUid == "1.2.840.10008.5.1.4.1.1.104.1") |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
842 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
843 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock()); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
844 lock->Schedule( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
845 GetSharedObserver(), PRIORITY_NORMAL, OrthancStone::ParseDicomFromWadoCommand::Create( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
846 source_, studyInstanceUid, seriesInstanceUid, sopInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
847 false /* no transcoding */, Orthanc::DicomTransferSyntax_LittleEndianExplicit /* dummy value */, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
848 new PdfInfo(studyInstanceUid, seriesInstanceUid))); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
849 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
850 return; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
851 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
852 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
853 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
854 LOG(WARNING) << "Series without a PDF: " << seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
855 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
856 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
857 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
858 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
859 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
860 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
861 class FramesCache : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
862 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
863 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 class CachedImage : public Orthanc::ICacheable |
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 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 std::unique_ptr<Orthanc::ImageAccessor> image_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 unsigned int quality_; |
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 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
871 CachedImage(Orthanc::ImageAccessor* image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
872 unsigned int quality) : |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
873 image_(image), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
874 quality_(quality) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
875 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
876 assert(image != NULL); |
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 |
1573 | 879 virtual size_t GetMemoryUsage() const ORTHANC_OVERRIDE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
880 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 assert(image_.get() != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
882 return (image_->GetBytesPerPixel() * image_->GetPitch() * image_->GetHeight()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
883 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
884 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
885 const Orthanc::ImageAccessor& GetImage() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
886 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
887 assert(image_.get() != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
888 return *image_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
889 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
890 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
891 unsigned int GetQuality() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
892 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
893 return quality_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
894 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
895 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
896 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
897 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
898 static std::string GetKey(const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
899 size_t frameNumber) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 { |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
901 return sopInstanceUid + "|" + boost::lexical_cast<std::string>(frameNumber); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
902 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
903 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
904 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
905 Orthanc::MemoryObjectCache cache_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
906 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
907 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
908 FramesCache() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
909 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
910 SetMaximumSize(100 * 1024 * 1024); // 100 MB |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
911 //SetMaximumSize(1); // DISABLE CACHE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
913 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
914 size_t GetMaximumSize() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
915 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
916 return cache_.GetMaximumSize(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
917 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
918 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
919 void SetMaximumSize(size_t size) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
920 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
921 cache_.SetMaximumSize(size); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
922 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
923 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
924 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
925 * Returns "true" iff the provided image has better quality than the |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
926 * previously cached one, or if no cache was previously available. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
927 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
928 bool Acquire(const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
929 size_t frameNumber, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
930 Orthanc::ImageAccessor* image /* transfer ownership */, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
931 unsigned int quality) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
932 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
933 std::unique_ptr<Orthanc::ImageAccessor> protection(image); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
934 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
935 if (image == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
936 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
937 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
938 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
939 else if (image->GetFormat() != Orthanc::PixelFormat_Float32 && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
940 image->GetFormat() != Orthanc::PixelFormat_RGB24) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
941 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
942 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
943 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
944 |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
945 const std::string& key = GetKey(sopInstanceUid, frameNumber); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
946 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
947 bool invalidate = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
948 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
949 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
950 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
951 * Access the previous cached entry, with side effect of tagging |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
952 * it as the most recently accessed frame (update of LRU recycling) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
953 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
954 Orthanc::MemoryObjectCache::Accessor accessor(cache_, key, false /* unique lock */); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
955 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
956 if (accessor.IsValid()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
957 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
958 const CachedImage& previous = dynamic_cast<const CachedImage&>(accessor.GetValue()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
959 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 // There is already a cached image for this frame |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
961 if (previous.GetQuality() < quality) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
962 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
963 // The previously stored image has poorer quality |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
964 invalidate = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
965 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
966 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
967 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
968 // No update in the quality, don't change the cache |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
969 return false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
970 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
971 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
972 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
973 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
974 invalidate = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
975 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
976 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
977 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
978 if (invalidate) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
979 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
980 cache_.Invalidate(key); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
981 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
982 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
983 cache_.Acquire(key, new CachedImage(protection.release(), quality)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
984 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
985 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
986 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 class Accessor : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
988 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
989 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
990 Orthanc::MemoryObjectCache::Accessor accessor_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
991 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
992 const CachedImage& GetCachedImage() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
993 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
994 if (IsValid()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
995 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
996 return dynamic_cast<CachedImage&>(accessor_.GetValue()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
997 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
998 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
999 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1000 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1001 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1002 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1003 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1004 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1005 Accessor(FramesCache& that, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1006 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1007 size_t frameNumber) : |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1008 accessor_(that.cache_, GetKey(sopInstanceUid, frameNumber), false /* shared lock */) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1011 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1012 bool IsValid() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1013 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1014 return accessor_.IsValid(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1015 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1016 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1017 const Orthanc::ImageAccessor& GetImage() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1018 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1019 return GetCachedImage().GetImage(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1020 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1021 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1022 unsigned int GetQuality() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1023 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1024 return GetCachedImage().GetQuality(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1025 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1026 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1027 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1028 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1029 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1030 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1031 class SeriesCursor : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1032 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1033 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1034 enum Action |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1035 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1036 Action_FastPlus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1037 Action_Plus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1038 Action_None, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1039 Action_Minus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1040 Action_FastMinus |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1041 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1042 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1043 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1044 std::vector<size_t> prefetch_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1045 int framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1046 int currentFrame_; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1047 bool isCircularPrefetch_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1048 int fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1049 Action lastAction_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1050 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1051 int ComputeNextFrame(int currentFrame, |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1052 Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1053 bool isCircular) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1054 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1055 if (framesCount_ == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1056 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1057 assert(currentFrame == 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1058 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1059 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1060 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1061 int nextFrame = currentFrame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1062 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1063 switch (action) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1065 case Action_FastPlus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1066 nextFrame += fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1067 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1068 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1069 case Action_Plus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1070 nextFrame += 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1072 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1073 case Action_None: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1074 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1075 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1076 case Action_Minus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1077 nextFrame -= 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1079 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1080 case Action_FastMinus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1081 nextFrame -= fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1082 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1083 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1084 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1085 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1086 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1087 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1088 if (isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1089 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1090 while (nextFrame < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1091 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1092 nextFrame += framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1093 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1094 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 while (nextFrame >= framesCount_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1096 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1097 nextFrame -= framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1098 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1099 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1100 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1101 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1102 if (nextFrame < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1103 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1104 nextFrame = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1105 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1106 else if (nextFrame >= framesCount_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1107 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1108 nextFrame = framesCount_ - 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1109 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1110 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1111 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1112 return nextFrame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1113 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1114 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1115 void UpdatePrefetch() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1116 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1117 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1118 * This method will order the frames of the series according to |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1119 * the number of "actions" (i.e. mouse wheels) that are necessary |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1120 * to reach them, starting from the current frame. It is assumed |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1121 * that once one action is done, it is more likely that the user |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1122 * will do the same action just afterwards. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1123 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1124 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1125 prefetch_.clear(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1126 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1127 if (framesCount_ == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1128 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1129 return; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1130 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1131 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1132 prefetch_.reserve(framesCount_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1133 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1134 // Breadth-first search using a FIFO. The queue associates a frame |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1135 // and the action that is the most likely in this frame |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1136 typedef std::list< std::pair<int, Action> > Queue; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1137 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1138 Queue queue; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1139 std::set<int> visited; // Frames that have already been visited |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1140 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1141 queue.push_back(std::make_pair(currentFrame_, lastAction_)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1142 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1143 while (!queue.empty()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1144 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1145 int frame = queue.front().first; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1146 Action previousAction = queue.front().second; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1147 queue.pop_front(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1148 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1149 if (visited.find(frame) == visited.end()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1150 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1151 visited.insert(frame); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1152 prefetch_.push_back(frame); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1153 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1154 switch (previousAction) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1155 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1156 case Action_None: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1157 case Action_Plus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1158 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Plus, isCircularPrefetch_), Action_Plus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1159 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Minus, isCircularPrefetch_), Action_Minus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1160 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastPlus, isCircularPrefetch_), Action_FastPlus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1161 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastMinus, isCircularPrefetch_), Action_FastMinus)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1162 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1163 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1164 case Action_Minus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1165 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Minus, isCircularPrefetch_), Action_Minus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1166 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Plus, isCircularPrefetch_), Action_Plus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1167 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastMinus, isCircularPrefetch_), Action_FastMinus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1168 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastPlus, isCircularPrefetch_), Action_FastPlus)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1169 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1170 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1171 case Action_FastPlus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1172 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastPlus, isCircularPrefetch_), Action_FastPlus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1173 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastMinus, isCircularPrefetch_), Action_FastMinus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1174 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Plus, isCircularPrefetch_), Action_Plus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1175 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Minus, isCircularPrefetch_), Action_Minus)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1176 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1177 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1178 case Action_FastMinus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1179 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastMinus, isCircularPrefetch_), Action_FastMinus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1180 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_FastPlus, isCircularPrefetch_), Action_FastPlus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1181 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Minus, isCircularPrefetch_), Action_Minus)); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1182 queue.push_back(std::make_pair(ComputeNextFrame(frame, Action_Plus, isCircularPrefetch_), Action_Plus)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1183 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1184 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1185 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1186 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1187 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1188 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1189 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1190 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1191 assert(prefetch_.size() == framesCount_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1192 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1193 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1194 bool CheckFrameIndex(int frame) const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1195 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1196 return ((framesCount_ == 0 && frame == 0) || |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1197 (framesCount_ > 0 && frame >= 0 && frame < framesCount_)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1198 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1199 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1200 public: |
1573 | 1201 explicit SeriesCursor(size_t framesCount) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1202 framesCount_(framesCount), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1203 currentFrame_(framesCount / 2), // Start at the middle frame |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1204 isCircularPrefetch_(false), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1205 lastAction_(Action_None) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1206 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1207 SetFastDelta(framesCount / 20); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1208 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1209 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1210 |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1211 size_t GetFramesCount() const |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1212 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1213 return framesCount_; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1214 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1215 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1216 void SetCircularPrefetch(bool isCircularPrefetch) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1217 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1218 isCircularPrefetch_ = isCircularPrefetch; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1219 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1220 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1221 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1222 void SetFastDelta(int delta) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1223 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1224 fastDelta_ = (delta < 0 ? -delta : delta); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1225 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1226 if (fastDelta_ <= 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1227 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1228 fastDelta_ = 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1229 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1230 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1231 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1232 void SetCurrentIndex(size_t frame) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1233 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1234 if (frame >= framesCount_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1236 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1237 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1238 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1239 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1240 currentFrame_ = frame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1241 lastAction_ = Action_None; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1242 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1243 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1244 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1245 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1246 size_t GetCurrentIndex() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1247 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1248 assert(CheckFrameIndex(currentFrame_)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1249 return static_cast<size_t>(currentFrame_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1250 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1251 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1252 void Apply(Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1253 bool isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1254 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1255 currentFrame_ = ComputeNextFrame(currentFrame_, action, isCircular); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1256 lastAction_ = action; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1257 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1258 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1259 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1260 size_t GetPrefetchSize() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1261 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1262 assert(prefetch_.size() == framesCount_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1263 return prefetch_.size(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1264 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1265 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1266 size_t GetPrefetchIndex(size_t i) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1267 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1268 if (i >= prefetch_.size()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1269 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1270 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1271 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1272 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1273 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1274 assert(CheckFrameIndex(prefetch_[i])); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1275 return static_cast<size_t>(prefetch_[i]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1276 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1277 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1278 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1279 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1280 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1281 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1282 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1283 /** |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1284 * Returns a clipped line (out: x1, y1, x2, y2), in the coordinate |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1285 * system of "instance1". Note that the frame of reference UID is not |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1286 * checked by this function. |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1287 **/ |
1646
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1288 static bool GetReferenceLineCoordinates(double& x1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1289 double& y1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1290 double& x2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1291 double& y2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1292 const OrthancStone::DicomInstanceParameters& instance1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1293 unsigned int frame1, |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1294 const OrthancStone::CoordinateSystem3D& plane2) |
1646
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1295 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1296 if (instance1.GetWidth() == 0 && |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1297 instance1.GetHeight() == 0) |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1298 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1299 return false; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1300 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1301 else |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1302 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1303 /** |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1304 * Compute the 2D extent of the "instance1", expressed in |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1305 * centimeters, in the 2D plane defined by this DICOM instance. |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1306 * |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1307 * In a multiframe image (cf. "ExtractFrameOffsets()"), the plane of |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1308 * each frame is a translation of the plane of the first frame along |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1309 * its normal. As a consequence, the extent is the same for each |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1310 * frame, so we can ignore the frame number. |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1311 **/ |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1312 OrthancStone::Extent2D extent; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1313 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1314 double ox = -instance1.GetPixelSpacingX() / 2.0; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1315 double oy = -instance1.GetPixelSpacingY() / 2.0; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1316 extent.AddPoint(ox, oy); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1317 extent.AddPoint(ox + instance1.GetPixelSpacingX() * static_cast<double>(instance1.GetWidth()), |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1318 oy + instance1.GetPixelSpacingY() * static_cast<double>(instance1.GetHeight())); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1319 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1320 const OrthancStone::CoordinateSystem3D c1 = instance1.GetFrameGeometry(frame1); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1321 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1322 OrthancStone::Vector direction, origin; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1323 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1324 if (!extent.IsEmpty() && |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1325 OrthancStone::GeometryToolbox::IntersectTwoPlanes(origin, direction, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1326 c1.GetOrigin(), c1.GetNormal(), |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1327 plane2.GetOrigin(), plane2.GetNormal())) |
1646
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1328 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1329 double ax, ay, bx, by; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1330 c1.ProjectPoint(ax, ay, origin); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1331 c1.ProjectPoint(bx, by, origin + 100.0 * direction); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1332 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1333 return OrthancStone::GeometryToolbox::ClipLineToRectangle( |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1334 x1, y1, x2, y2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1335 ax, ay, bx, by, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1336 extent.GetX1(), extent.GetY1(), extent.GetX2(), extent.GetY2()); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1337 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1338 else |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1339 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1340 return false; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1341 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1342 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1343 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1344 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1345 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1346 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1347 class StoneAnnotationsRegistry : public boost::noncopyable |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1348 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1349 private: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1350 class Index |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1351 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1352 private: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1353 std::string sopInstanceUid_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1354 size_t frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1355 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1356 public: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1357 Index(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1358 size_t frame) : |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1359 sopInstanceUid_(sopInstanceUid), |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1360 frame_(frame) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1361 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1362 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1363 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1364 const std::string& GetSopInstanceUid() const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1365 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1366 return sopInstanceUid_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1367 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1368 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1369 size_t GetFrame() const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1370 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1371 return frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1372 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1373 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1374 bool operator< (const Index& other) const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1375 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1376 if (sopInstanceUid_ < other.sopInstanceUid_) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1377 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1378 return true; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1379 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1380 else if (sopInstanceUid_ > other.sopInstanceUid_) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1381 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1382 return false; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1383 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1384 else |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1385 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1386 return frame_ < other.frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1387 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1388 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1389 }; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1390 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1391 typedef std::map<Index, Json::Value*> Content; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1392 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1393 Content content_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1394 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1395 void Clear() |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1396 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1397 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1398 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1399 assert(it->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1400 delete it->second; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1401 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1402 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1403 content_.clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1404 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1405 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1406 StoneAnnotationsRegistry() |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1407 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1408 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1409 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1410 public: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1411 ~StoneAnnotationsRegistry() |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1412 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1413 Clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1414 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1415 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1416 static StoneAnnotationsRegistry& GetInstance() |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1417 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1418 static StoneAnnotationsRegistry singleton; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1419 return singleton; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1420 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1421 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1422 void Save(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1423 size_t frame, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1424 const OrthancStone::AnnotationsSceneLayer& layer) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1425 { |
1814 | 1426 std::unique_ptr<Json::Value> serialized(new Json::Value); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1427 layer.Serialize(*serialized); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1428 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1429 const Index index(sopInstanceUid, frame); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1430 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1431 Content::iterator found = content_.find(index); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1432 if (found == content_.end()) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1433 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1434 content_[index] = serialized.release(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1435 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1436 else |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1437 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1438 assert(found->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1439 delete found->second; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1440 found->second = serialized.release(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1441 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1442 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1443 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1444 void Load(OrthancStone::AnnotationsSceneLayer& layer, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1445 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1446 size_t frame) const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1447 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1448 const Index index(sopInstanceUid, frame); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1449 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1450 Content::const_iterator found = content_.find(index); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1451 if (found == content_.end()) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1452 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1453 layer.Clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1454 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1455 else |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1456 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1457 assert(found->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1458 layer.Unserialize(*found->second); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1459 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1460 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1461 }; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1462 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1463 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1464 |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1465 class OverlaysRegistry : public boost::noncopyable |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1466 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1467 private: |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1468 typedef std::map<std::string, OrthancStone::LookupTableTextureSceneLayer*> Content; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1469 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1470 Content content_; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1471 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1472 public: |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1473 ~OverlaysRegistry() |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1474 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1475 for (Content::iterator it = content_.begin(); it != content_.end(); ++it) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1476 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1477 assert(it->second != NULL); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1478 delete it->second; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1479 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1480 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1481 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1482 static OverlaysRegistry& GetInstance() |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1483 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1484 static OverlaysRegistry singleton; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1485 return singleton; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1486 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1487 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1488 void Register(const std::string& sopInstanceUid, |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1489 const OrthancStone::DicomInstanceParameters& parameters, |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1490 int overlayX, |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1491 int overlayY, |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1492 const Orthanc::ImageAccessor& overlay) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1493 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1494 // Don't register twice the same overlay |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1495 Content::iterator found = content_.find(sopInstanceUid); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1496 if (found == content_.end()) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1497 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1498 content_[sopInstanceUid] = parameters.CreateOverlayTexture(overlayX, overlayY, overlay); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1499 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1500 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1501 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1502 class Accessor : public boost::noncopyable |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1503 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1504 private: |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1505 const OrthancStone::LookupTableTextureSceneLayer* texture_; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1506 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1507 public: |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1508 Accessor(const OverlaysRegistry& registry, |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1509 const std::string& sopInstanceUid) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1510 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1511 Content::const_iterator found = registry.content_.find(sopInstanceUid); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1512 if (found == registry.content_.end()) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1513 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1514 texture_ = NULL; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1515 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1516 else |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1517 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1518 assert(found->second != NULL); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1519 texture_ = found->second; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1520 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1521 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1522 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1523 bool IsValid() const |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1524 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1525 return texture_ != NULL; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1526 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1527 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1528 OrthancStone::LookupTableTextureSceneLayer* CreateTexture() const |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1529 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1530 if (texture_ == NULL) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1531 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1532 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1533 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1534 else |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1535 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1536 return dynamic_cast<OrthancStone::LookupTableTextureSceneLayer*>(texture_->Clone()); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1537 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1538 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1539 }; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1540 }; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1541 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1542 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1543 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1544 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1545 class ViewerViewport : public OrthancStone::ObserverBase<ViewerViewport> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1546 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1547 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1548 class IObserver : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1549 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1550 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1551 virtual ~IObserver() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1552 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1553 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1554 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1555 virtual void SignalSeriesDetailsReady(const ViewerViewport& viewport) = 0; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1556 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1557 virtual void SignalFrameUpdated(const ViewerViewport& viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1558 size_t currentFrame, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1559 size_t countFrames, |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1560 DisplayedFrameQuality quality, |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1561 unsigned int instanceNumber, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1562 const std::string& contentDate, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1563 const std::string& contentTime) = 0; |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
1564 |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
1565 // "click" is a 3D vector in world coordinates |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1566 virtual void SignalCrosshair(const ViewerViewport& viewport, |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1567 const OrthancStone::Vector& click) = 0; |
1694 | 1568 |
1569 virtual void SignalSynchronizedBrowsing(const ViewerViewport& viewport, | |
1570 const OrthancStone::Vector& click, | |
1571 const OrthancStone::Vector& normal) = 0; | |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1572 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1573 virtual void SignalWindowingUpdated(const ViewerViewport& viewport, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1574 double windowingCenter, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1575 double windowingWidth) = 0; |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1576 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1577 virtual void SignalStoneAnnotationsChanged(const ViewerViewport& viewport, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1578 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1579 size_t frame) = 0; |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1580 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1581 virtual void SignalStoneAnnotationAdded(const ViewerViewport& viewport) = 0; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1582 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1583 virtual void SignalStoneAnnotationRemoved(const ViewerViewport& viewport) = 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1584 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1585 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1586 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1587 static const int LAYER_TEXTURE = 0; |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1588 static const int LAYER_OVERLAY = 1; |
1963 | 1589 static const int LAYER_ORIENTATION_MARKERS = 2; |
1590 static const int LAYER_REFERENCE_LINES = 3; | |
1591 static const int LAYER_ANNOTATIONS_OSIRIX = 4; | |
1592 static const int LAYER_ANNOTATIONS_STONE = 5; | |
1964
2034ae383cfd
integration default->deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
diff
changeset
|
1593 static const int LAYER_DEEP_LEARNING = 6; |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1607
diff
changeset
|
1594 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1595 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1596 class ICommand : public Orthanc::IDynamicObject |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1597 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1598 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1599 boost::shared_ptr<ViewerViewport> viewport_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1600 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1601 public: |
1573 | 1602 explicit ICommand(boost::shared_ptr<ViewerViewport> viewport) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1603 viewport_(viewport) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1604 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1605 if (viewport == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1606 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1607 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1608 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1609 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1610 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1611 virtual ~ICommand() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1612 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1613 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1614 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1615 ViewerViewport& GetViewport() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1616 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1617 assert(viewport_ != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1618 return *viewport_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1619 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1620 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1621 virtual void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1622 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1623 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1624 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1625 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1626 virtual void Handle(const OrthancStone::HttpCommand::SuccessMessage& message) const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1627 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1628 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1629 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1630 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1631 virtual void Handle(const OrthancStone::ParseDicomSuccessMessage& message) const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1632 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1633 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1634 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1635 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1636 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1637 class LoadSeriesDetailsFromInstance : public ICommand |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1638 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1639 public: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1640 explicit LoadSeriesDetailsFromInstance(boost::shared_ptr<ViewerViewport> viewport) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1641 ICommand(viewport) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1642 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1643 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1644 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1645 virtual void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) const ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1646 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1647 if (message.GetResources()->GetSize() != 1) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1648 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1649 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1650 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1651 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1652 const Orthanc::DicomMap& dicom = message.GetResources()->GetResource(0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1653 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1654 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1655 OrthancStone::DicomInstanceParameters params(dicom); |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1656 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1657 params.EnrichUsingDicomWeb(message.GetResources()->GetSourceJson(0)); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1658 GetViewport().centralPixelSpacingX_ = params.GetPixelSpacingX(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1659 GetViewport().centralPixelSpacingY_ = params.GetPixelSpacingY(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1660 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1661 if (params.HasPixelSpacing()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1662 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1663 GetViewport().stoneAnnotations_->SetUnits(OrthancStone::Units_Millimeters); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1664 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1665 else |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1666 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1667 GetViewport().stoneAnnotations_->SetUnits(OrthancStone::Units_Pixels); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1668 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1669 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1670 if (params.GetPixelSpacingX() != 0 && |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1671 params.GetPixelSpacingY() != 0 && |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1672 params.GetWidth() != 0 && |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1673 params.GetHeight()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1674 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1675 GetViewport().centralPhysicalWidth_ = (params.GetPixelSpacingX() * |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1676 static_cast<double>(params.GetWidth())); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1677 GetViewport().centralPhysicalHeight_ = (params.GetPixelSpacingY() * |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1678 static_cast<double>(params.GetHeight())); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1679 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1680 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1681 GetViewport().windowingPresetCenters_.resize(params.GetWindowingPresetsCount()); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1682 GetViewport().windowingPresetWidths_.resize(params.GetWindowingPresetsCount()); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1683 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1684 for (size_t i = 0; i < params.GetWindowingPresetsCount(); i++) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1685 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1686 LOG(INFO) << "Preset windowing " << (i + 1) << "/" << params.GetWindowingPresetsCount() |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1687 << ": " << params.GetWindowingPresetCenter(i) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1688 << "," << params.GetWindowingPresetWidth(i); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1689 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1690 GetViewport().windowingPresetCenters_[i] = params.GetWindowingPresetCenter(i); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1691 GetViewport().windowingPresetWidths_[i] = params.GetWindowingPresetWidth(i); |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1692 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1693 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1694 if (params.GetWindowingPresetsCount() == 0) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1695 { |
1677
51bab5188a13
start multiple preset windowings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1676
diff
changeset
|
1696 LOG(INFO) << "No preset windowing"; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1697 } |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1698 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1699 GetViewport().SetWindowingPreset(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1700 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1701 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1702 uint32_t cineRate; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1703 if (dicom.ParseUnsignedInteger32(cineRate, Orthanc::DICOM_TAG_CINE_RATE) && |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1704 cineRate > 0) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1705 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1706 /** |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1707 * If we detect a cine sequence, start on the first frame |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1708 * instead of on the middle frame. |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1709 **/ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1710 GetViewport().cursor_->SetCurrentIndex(0); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1711 GetViewport().cineRate_ = cineRate; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1712 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1713 else |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1714 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1715 GetViewport().cineRate_ = DEFAULT_CINE_RATE; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1716 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1717 |
1668 | 1718 GetViewport().Redraw(); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1719 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1720 if (GetViewport().observer_.get() != NULL) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1721 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1722 GetViewport().observer_->SignalSeriesDetailsReady(GetViewport()); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1723 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1724 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1725 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1726 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
1727 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1728 class SetLowQualityFrame : public ICommand |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1729 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1730 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1731 std::string sopInstanceUid_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1732 unsigned int frameNumber_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1733 float windowCenter_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1734 float windowWidth_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1735 bool isMonochrome1_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1736 bool isPrefetch_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1737 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1738 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1739 SetLowQualityFrame(boost::shared_ptr<ViewerViewport> viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1740 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1741 unsigned int frameNumber, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1742 float windowCenter, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1743 float windowWidth, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1744 bool isMonochrome1, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1745 bool isPrefetch) : |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1746 ICommand(viewport), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1747 sopInstanceUid_(sopInstanceUid), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1748 frameNumber_(frameNumber), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1749 windowCenter_(windowCenter), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1750 windowWidth_(windowWidth), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1751 isMonochrome1_(isMonochrome1), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1752 isPrefetch_(isPrefetch) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1753 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1754 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1755 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1756 virtual void Handle(const OrthancStone::HttpCommand::SuccessMessage& message) const ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1757 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1758 std::unique_ptr<Orthanc::JpegReader> jpeg(new Orthanc::JpegReader); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1759 jpeg->ReadFromMemory(message.GetAnswer()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1760 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1761 std::unique_ptr<Orthanc::ImageAccessor> converted; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1762 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1763 switch (jpeg->GetFormat()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1764 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1765 case Orthanc::PixelFormat_RGB24: |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1766 converted.reset(jpeg.release()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1767 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1768 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1769 case Orthanc::PixelFormat_Grayscale8: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1770 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1771 if (isMonochrome1_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1772 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1773 Orthanc::ImageProcessing::Invert(*jpeg); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1774 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1775 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1776 converted.reset(new Orthanc::Image(Orthanc::PixelFormat_Float32, jpeg->GetWidth(), |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1777 jpeg->GetHeight(), false)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1778 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1779 Orthanc::ImageProcessing::Convert(*converted, *jpeg); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1780 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1781 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1782 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1783 Orthanc::ImageProcessing::ShiftScale() computes "(x + offset) * scaling". |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1784 The system to solve is thus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1785 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1786 (0 + offset) * scaling = windowingCenter - windowingWidth / 2 [a] |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1787 (255 + offset) * scaling = windowingCenter + windowingWidth / 2 [b] |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1788 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1789 Resolution: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1790 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1791 [b - a] => 255 * scaling = windowingWidth |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1792 [a] => offset = (windowingCenter - windowingWidth / 2) / scaling |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1793 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1794 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1795 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1796 const float scaling = windowWidth_ / 255.0f; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1797 const float offset = (OrthancStone::LinearAlgebra::IsCloseToZero(scaling) ? 0 : |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1798 (windowCenter_ - windowWidth_ / 2.0f) / scaling); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1799 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1800 Orthanc::ImageProcessing::ShiftScale(*converted, offset, scaling, false); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1801 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1802 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1803 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1804 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1805 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1806 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1807 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1808 assert(converted.get() != NULL); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1809 GetViewport().RenderCurrentSceneFromCommand(*converted, sopInstanceUid_, frameNumber_, DisplayedFrameQuality_Low); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1810 GetViewport().framesCache_->Acquire(sopInstanceUid_, frameNumber_, converted.release(), QUALITY_JPEG); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1811 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1812 if (isPrefetch_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1813 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1814 GetViewport().ScheduleNextPrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1815 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1816 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1817 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1818 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1819 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1820 class SetFullDicomFrame : public ICommand |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1821 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1822 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1823 std::string sopInstanceUid_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1824 unsigned int frameNumber_; |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1825 int priority_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1826 bool isPrefetch_; |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1827 bool serverSideTranscoding_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1828 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1829 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1830 SetFullDicomFrame(boost::shared_ptr<ViewerViewport> viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1831 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1832 unsigned int frameNumber, |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1833 int priority, |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1834 bool isPrefetch, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1835 bool serverSideTranscoding) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1836 ICommand(viewport), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1837 sopInstanceUid_(sopInstanceUid), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1838 frameNumber_(frameNumber), |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1839 priority_(priority), |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1840 isPrefetch_(isPrefetch), |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1841 serverSideTranscoding_(serverSideTranscoding) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1842 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1843 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1844 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1845 virtual void Handle(const OrthancStone::ParseDicomSuccessMessage& message) const ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1846 { |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1847 std::unique_ptr<Orthanc::ImageAccessor> frame; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1848 |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1849 try |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1850 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1851 frame.reset(message.GetDicom().DecodeFrame(frameNumber_)); |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1852 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1853 catch (Orthanc::OrthancException& e) |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1854 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1855 if (e.GetErrorCode() == Orthanc::ErrorCode_NotImplemented) |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1856 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1857 if (!serverSideTranscoding_) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1858 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1859 // If we haven't tried server-side rendering yet, give it a try |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1860 LOG(INFO) << "Switching to server-side transcoding"; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1861 GetViewport().serverSideTranscoding_ = true; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1862 GetViewport().ScheduleLoadFullDicomFrame(sopInstanceUid_, frameNumber_, priority_, isPrefetch_); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1863 } |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1864 return; |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1865 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1866 else |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1867 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1868 throw; |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1869 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1870 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1871 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1872 if (frame.get() == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1873 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1874 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1875 } |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1876 else |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1877 { |
1855
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1878 if (GetViewport().windowingPresetCenters_.empty()) |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1879 { |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1880 // New in Stone Web viewer 2.2: Deal with Philips multiframe |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1881 // (cf. mail from Tomas Kenda on 2021-08-17) |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1882 double windowingCenter, windowingWidth; |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1883 message.GetDicom().GetDefaultWindowing(windowingCenter, windowingWidth, frameNumber_); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1884 GetViewport().windowingPresetCenters_.push_back(windowingCenter); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1885 GetViewport().windowingPresetWidths_.push_back(windowingWidth); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1886 GetViewport().SetWindowingPreset(); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1887 } |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1888 |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1889 Apply(GetViewport(), message.GetDicom(), frame.release(), sopInstanceUid_, frameNumber_); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1890 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1891 if (isPrefetch_) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1892 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1893 GetViewport().ScheduleNextPrefetch(); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1894 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1895 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1896 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1897 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1898 static void Apply(ViewerViewport& viewport, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1899 const Orthanc::ParsedDicomFile& dicom, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1900 Orthanc::ImageAccessor* f, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1901 const std::string& sopInstanceUid, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1902 unsigned int frameNumber) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1903 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1904 std::unique_ptr<Orthanc::ImageAccessor> frameProtection(f); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1905 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1906 Orthanc::DicomMap tags; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1907 dicom.ExtractDicomSummary(tags, ORTHANC_STONE_MAX_TAG_LENGTH); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1908 |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1909 OrthancStone::DicomInstanceParameters parameters(tags); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1910 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1911 std::unique_ptr<Orthanc::ImageAccessor> converted; |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1912 |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1913 if (frameProtection->GetFormat() == Orthanc::PixelFormat_RGB24) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1914 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1915 converted.reset(frameProtection.release()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1916 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1917 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1918 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1919 converted.reset(new Orthanc::Image(Orthanc::PixelFormat_Float32, frameProtection->GetWidth(), frameProtection->GetHeight(), false)); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1920 Orthanc::ImageProcessing::Convert(*converted, *frameProtection); |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1921 parameters.ApplyRescaleAndDoseScaling(*converted, false /* don't use double */); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1922 } |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1923 |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1924 try |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1925 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1926 int x, y; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1927 std::unique_ptr<Orthanc::ImageAccessor> overlay(dicom.DecodeAllOverlays(x, y)); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1928 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1929 if (overlay.get() != NULL && |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1930 overlay->GetWidth() > 0 && |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1931 overlay->GetHeight() > 0) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1932 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1933 OverlaysRegistry::GetInstance().Register(sopInstanceUid, parameters, x, y, *overlay); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1934 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1935 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1936 catch (Orthanc::OrthancException& e) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1937 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1938 LOG(ERROR) << "Cannot decode overlays from instance " << sopInstanceUid; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1939 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
1940 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1941 assert(converted.get() != NULL); |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
1942 viewport.RenderCurrentSceneFromCommand(*converted, sopInstanceUid, frameNumber, DisplayedFrameQuality_High); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1943 viewport.framesCache_->Acquire(sopInstanceUid, frameNumber, converted.release(), QUALITY_FULL); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1944 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1945 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1946 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1947 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1948 class PrefetchItem |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1949 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1950 private: |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1951 size_t cursorIndex_; |
1670 | 1952 bool isFullQuality_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1953 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1954 public: |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1955 PrefetchItem(size_t cursorIndex, |
1670 | 1956 bool isFullQuality) : |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1957 cursorIndex_(cursorIndex), |
1670 | 1958 isFullQuality_(isFullQuality) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1959 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1960 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1961 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1962 size_t GetCursorIndex() const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1963 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1964 return cursorIndex_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1965 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1966 |
1670 | 1967 bool IsFullQuality() const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1968 { |
1670 | 1969 return isFullQuality_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1970 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1971 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1972 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1973 |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1974 std::unique_ptr<IObserver> observer_; |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
1975 OrthancStone::WebAssemblyLoadersContext& context_; |
1551
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
1976 boost::shared_ptr<OrthancStone::WebAssemblyViewport> viewport_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1977 boost::shared_ptr<OrthancStone::DicomResourcesLoader> loader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1978 OrthancStone::DicomSource source_; |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1979 boost::shared_ptr<FramesCache> framesCache_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1980 std::unique_ptr<OrthancStone::SortedFrames> frames_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1981 std::unique_ptr<SeriesCursor> cursor_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1982 float windowingCenter_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1983 float windowingWidth_; |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1984 std::vector<float> windowingPresetCenters_; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1985 std::vector<float> windowingPresetWidths_; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1986 unsigned int cineRate_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1987 bool inverted_; |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
1988 bool flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
1989 bool flipY_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1990 bool fitNextContent_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1991 std::list<PrefetchItem> prefetchQueue_; |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1992 bool serverSideTranscoding_; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1993 OrthancStone::Vector synchronizationOffset_; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1994 bool synchronizationEnabled_; |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
1995 double centralPhysicalWidth_; // LSD-479 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
1996 double centralPhysicalHeight_; |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1997 double centralPixelSpacingX_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1998 double centralPixelSpacingY_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1999 |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2000 bool hasFocusOnInstance_; |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2001 std::string focusSopInstanceUid_; |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2002 size_t focusFrameNumber_; |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2003 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2004 // The coordinates of OsiriX annotations are expressed in 3D world coordinates |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2005 boost::shared_ptr<OrthancStone::OsiriX::CollectionOfAnnotations> osiriXAnnotations_; |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2006 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2007 // The coordinates of Stone annotations are expressed in 2D |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2008 // coordinates of the current texture, with (0,0) corresponding to |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
2009 // the center of the top-left pixel |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2010 boost::shared_ptr<OrthancStone::AnnotationsSceneLayer> stoneAnnotations_; |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2011 |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2012 boost::shared_ptr<Orthanc::ImageAccessor> deepLearningMask_; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2013 std::string deepLearningSopInstanceUid_; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2014 unsigned int deepLearningFrameNumber_; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2015 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2016 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2017 void ScheduleNextPrefetch() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2018 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2019 while (!prefetchQueue_.empty()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2020 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2021 size_t cursorIndex = prefetchQueue_.front().GetCursorIndex(); |
1670 | 2022 bool isFullQuality = prefetchQueue_.front().IsFullQuality(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2023 prefetchQueue_.pop_front(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2024 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2025 const std::string sopInstanceUid = frames_->GetInstanceOfFrame(cursorIndex).GetSopInstanceUid(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2026 unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2027 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2028 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2029 FramesCache::Accessor accessor(*framesCache_, sopInstanceUid, frameNumber); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2030 if (!accessor.IsValid() || |
1670 | 2031 (isFullQuality && accessor.GetQuality() == 0)) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2032 { |
1670 | 2033 if (isFullQuality) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2034 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2035 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_NORMAL, true); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2036 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2037 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2038 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2039 ScheduleLoadRenderedFrame(cursorIndex, PRIORITY_NORMAL, true); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2040 } |
1670 | 2041 |
2042 return; // We have found a new frame to cache, stop the lookup loop | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2043 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2044 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2045 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2046 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2047 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2048 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2049 void ClearViewport() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2050 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2051 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2052 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2053 lock->GetController().GetScene().DeleteLayer(LAYER_TEXTURE); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2054 //lock->GetCompositor().Refresh(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2055 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2056 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2057 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2058 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
2059 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2060 /** |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2061 * NB: "frame" is only used to estimate the memory size to store 1 |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2062 * frame, in order to avoid prefetching too much data. |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2063 **/ |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2064 void SetupPrefetchAfterRendering(const Orthanc::ImageAccessor& frame, |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2065 DisplayedFrameQuality quality) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2066 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2067 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2068 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2069 // Prepare prefetching |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2070 prefetchQueue_.clear(); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2071 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2072 if (1) // DISABLE PREFETCHING |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2073 { |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
2074 const size_t frameSize = frame.GetPitch() * frame.GetHeight(); |
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
2075 size_t prefetchedSize = 0; |
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
2076 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2077 for (size_t i = 0; i < cursor_->GetPrefetchSize() && i < 16 && |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2078 prefetchedSize <= framesCache_->GetMaximumSize() / 2; i++) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2079 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2080 size_t a = cursor_->GetPrefetchIndex(i); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2081 if (a != cursorIndex) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2082 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2083 prefetchQueue_.push_back(PrefetchItem(a, i < 2)); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2084 prefetchedSize += frameSize; |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2085 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2086 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2087 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2088 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2089 ScheduleNextPrefetch(); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2090 |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2091 if (frames_.get() != NULL && |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2092 cursor_.get() != NULL && |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2093 observer_.get() != NULL) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2094 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2095 const Orthanc::DicomMap& instance = frames_->GetInstanceOfFrame(cursor_->GetCurrentIndex()).GetTags(); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2096 |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2097 uint32_t instanceNumber = 0; |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2098 std::string contentDate; |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2099 std::string contentTime; |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2100 |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2101 instance.ParseUnsignedInteger32(instanceNumber, Orthanc::DICOM_TAG_INSTANCE_NUMBER); |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2102 instance.LookupStringValue(contentDate, Orthanc::DicomTag(0x0008, 0x0023), false); |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2103 instance.LookupStringValue(contentTime, Orthanc::DicomTag(0x0008, 0x0033), false); |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2104 |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2105 observer_->SignalFrameUpdated(*this, cursorIndex, frames_->GetFramesCount(), quality, instanceNumber, contentDate, contentTime); |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2106 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2107 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2108 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2109 |
1668 | 2110 void RenderCurrentScene(const Orthanc::ImageAccessor& frame, |
2111 const OrthancStone::DicomInstanceParameters& instance, | |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2112 size_t frameIndex, |
1668 | 2113 const OrthancStone::CoordinateSystem3D& plane) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2114 { |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2115 /** |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2116 * IMPORTANT - DO NOT use "instance.GetWidth()" and |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2117 * "instance.GetHeight()" in this method. Use the information from |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2118 * "frame" instead. Indeed, the "instance" information is taken |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2119 * from DICOMweb "/studies/.../series/.../metadata". But, |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2120 * "SeriesMetadataExtrapolatedTags" includes the "Columns" and |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2121 * "Rows" DICOM tags for performance, which make this information |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2122 * unreliable if the series includes instances with varying sizes |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2123 * (cf. LSD-479). |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2124 **/ |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2125 |
1668 | 2126 bool isMonochrome1 = (instance.GetImageInformation().GetPhotometricInterpretation() == |
2127 Orthanc::PhotometricInterpretation_Monochrome1); | |
2128 | |
2129 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer; | |
2130 | |
2131 switch (frame.GetFormat()) | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2132 { |
1668 | 2133 case Orthanc::PixelFormat_RGB24: |
2134 layer.reset(new OrthancStone::ColorTextureSceneLayer(frame)); | |
2135 break; | |
2136 | |
2137 case Orthanc::PixelFormat_Float32: | |
2138 { | |
2139 std::unique_ptr<OrthancStone::FloatTextureSceneLayer> tmp( | |
2140 new OrthancStone::FloatTextureSceneLayer(frame)); | |
2141 tmp->SetCustomWindowing(windowingCenter_, windowingWidth_); | |
2142 tmp->SetInverted(inverted_ ^ isMonochrome1); | |
2143 layer.reset(tmp.release()); | |
2144 break; | |
2145 } | |
2146 | |
2147 default: | |
2148 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2149 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2150 |
1668 | 2151 assert(layer.get() != NULL); |
2152 | |
2153 layer->SetLinearInterpolation(true); | |
2154 layer->SetFlipX(flipX_); | |
2155 layer->SetFlipY(flipY_); | |
2156 | |
2157 double pixelSpacingX, pixelSpacingY; | |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2158 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2159 if (instance.HasPixelSpacing()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2160 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2161 pixelSpacingX = instance.GetPixelSpacingX(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2162 pixelSpacingY = instance.GetPixelSpacingY(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2163 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2164 else |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2165 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2166 pixelSpacingX = centralPixelSpacingX_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2167 pixelSpacingY = centralPixelSpacingY_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2168 } |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2169 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2170 if (FIX_LSD_479) |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2171 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2172 /** |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2173 * Some series contain a first instance (secondary capture) that |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2174 * is completely different from others wrt. to resolution and |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2175 * pixel spacing. We make sure to rescale each frame to fit in a |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2176 * square that corresponds to the extent of the frame in the |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2177 * middle of the series. |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2178 **/ |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2179 double physicalWidth = pixelSpacingX * static_cast<double>(frame.GetWidth()); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2180 double physicalHeight = pixelSpacingY * static_cast<double>(frame.GetHeight()); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2181 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2182 if (OrthancStone::LinearAlgebra::IsCloseToZero(physicalWidth) || |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2183 OrthancStone::LinearAlgebra::IsCloseToZero(physicalHeight)) |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2184 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2185 // Numerical instability, don't try further processing |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2186 layer->SetPixelSpacing(pixelSpacingX, pixelSpacingY); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2187 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2188 else |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2189 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2190 double scale = std::max(centralPhysicalWidth_ / physicalWidth, |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2191 centralPhysicalHeight_ / physicalHeight); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2192 layer->SetPixelSpacing(pixelSpacingX * scale, pixelSpacingY * scale); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2193 layer->SetOrigin((centralPhysicalWidth_ - physicalWidth * scale) / 2.0, |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2194 (centralPhysicalHeight_ - physicalHeight * scale) / 2.0); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2195 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2196 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2197 else |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2198 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2199 layer->SetPixelSpacing(pixelSpacingX, pixelSpacingY); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2200 } |
1668 | 2201 |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2202 std::unique_ptr<OrthancStone::LookupTableTextureSceneLayer> overlay; |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2203 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2204 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2205 OverlaysRegistry::Accessor accessor(OverlaysRegistry::GetInstance(), instance.GetSopInstanceUid()); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2206 if (accessor.IsValid()) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2207 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2208 overlay.reset(accessor.CreateTexture()); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2209 overlay->SetFlipX(flipX_); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2210 overlay->SetFlipY(flipY_); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2211 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2212 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2213 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2214 std::unique_ptr<OrthancStone::MacroSceneLayer> annotationsOsiriX; |
1668 | 2215 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2216 if (osiriXAnnotations_) |
1668 | 2217 { |
2218 std::set<size_t> a; | |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2219 osiriXAnnotations_->LookupSopInstanceUid(a, instance.GetSopInstanceUid()); |
1668 | 2220 if (plane.IsValid() && |
2221 !a.empty()) | |
2222 { | |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2223 annotationsOsiriX.reset(new OrthancStone::MacroSceneLayer); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2224 // annotationsOsiriX->Reserve(a.size()); |
1668 | 2225 |
2226 OrthancStone::OsiriXLayerFactory factory; | |
2227 factory.SetColor(0, 255, 0); | |
2228 | |
2229 for (std::set<size_t>::const_iterator it = a.begin(); it != a.end(); ++it) | |
2230 { | |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2231 const OrthancStone::OsiriX::Annotation& annotation = osiriXAnnotations_->GetAnnotation(*it); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2232 annotationsOsiriX->AddLayer(factory.Create(annotation, plane)); |
1668 | 2233 } |
2234 } | |
2235 } | |
2236 | |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2237 std::unique_ptr<OrthancStone::LookupTableTextureSceneLayer> deepLearningLayer; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2238 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2239 if (deepLearningMask_.get() != NULL && |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2240 deepLearningSopInstanceUid_ == instance.GetSopInstanceUid() && |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2241 deepLearningFrameNumber_ == frameIndex) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2242 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2243 std::vector<uint8_t> lut(4 * 256); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2244 for (unsigned int v = 128; v < 256; v++) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2245 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2246 lut[4 * v] = 196; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2247 lut[4 * v + 1] = 0; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2248 lut[4 * v + 2] = 0; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2249 lut[4 * v + 3] = 196; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2250 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2251 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2252 deepLearningLayer.reset(new OrthancStone::LookupTableTextureSceneLayer(*deepLearningMask_)); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2253 deepLearningLayer->SetLookupTable(lut); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2254 deepLearningLayer->SetPixelSpacing(pixelSpacingX, pixelSpacingY); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2255 deepLearningLayer->SetFlipX(flipX_); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2256 deepLearningLayer->SetFlipY(flipY_); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2257 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2258 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2259 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frameIndex); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2260 |
1962
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2261 // Orientation markers, new in Stone Web viewer 2.4 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2262 std::unique_ptr<OrthancStone::MacroSceneLayer> orientationMarkers; |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2263 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2264 if (instance.GetGeometry().IsValid()) |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2265 { |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2266 orientationMarkers.reset(new OrthancStone::MacroSceneLayer); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2267 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2268 std::string top, bottom, left, right; |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2269 instance.GetGeometry().GetOrientationMarkers(top, bottom, left, right); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2270 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2271 std::unique_ptr<OrthancStone::TextSceneLayer> text; |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2272 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2273 text.reset(new OrthancStone::TextSceneLayer); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2274 text->SetText(top); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2275 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()) / 2.0, 0); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2276 text->SetAnchor(OrthancStone::BitmapAnchor_TopCenter); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2277 orientationMarkers->AddLayer(text.release()); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2278 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2279 text.reset(new OrthancStone::TextSceneLayer); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2280 text->SetText(bottom); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2281 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()) / 2.0, |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2282 pixelSpacingY * static_cast<double>(frame.GetHeight())); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2283 text->SetAnchor(OrthancStone::BitmapAnchor_BottomCenter); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2284 orientationMarkers->AddLayer(text.release()); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2285 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2286 text.reset(new OrthancStone::TextSceneLayer); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2287 text->SetText(left); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2288 text->SetPosition(0, pixelSpacingY * static_cast<double>(frame.GetHeight()) / 2.0); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2289 text->SetAnchor(OrthancStone::BitmapAnchor_CenterLeft); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2290 orientationMarkers->AddLayer(text.release()); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2291 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2292 text.reset(new OrthancStone::TextSceneLayer); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2293 text->SetText(right); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2294 text->SetPosition(pixelSpacingX * static_cast<double>(frame.GetWidth()), |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2295 pixelSpacingY * static_cast<double>(frame.GetHeight()) / 2.0); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2296 text->SetAnchor(OrthancStone::BitmapAnchor_CenterRight); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2297 orientationMarkers->AddLayer(text.release()); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2298 } |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2299 |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2300 |
1668 | 2301 { |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2302 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2303 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2304 OrthancStone::Scene2D& scene = lock->GetController().GetScene(); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2305 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2306 scene.SetLayer(LAYER_TEXTURE, layer.release()); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2307 |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2308 if (overlay.get() != NULL) |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2309 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2310 scene.SetLayer(LAYER_OVERLAY, overlay.release()); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2311 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2312 else |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2313 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2314 scene.DeleteLayer(LAYER_OVERLAY); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2315 } |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2316 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2317 if (annotationsOsiriX.get() != NULL) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2318 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2319 scene.SetLayer(LAYER_ANNOTATIONS_OSIRIX, annotationsOsiriX.release()); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2320 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2321 else |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2322 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2323 scene.DeleteLayer(LAYER_ANNOTATIONS_OSIRIX); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2324 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2325 |
1962
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2326 if (orientationMarkers.get() != NULL) |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2327 { |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2328 scene.SetLayer(LAYER_ORIENTATION_MARKERS, orientationMarkers.release()); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2329 } |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2330 else |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2331 { |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2332 scene.DeleteLayer(LAYER_ORIENTATION_MARKERS); |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2333 } |
c6272d7bb6d9
display of orientation markers in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2334 |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2335 if (deepLearningLayer.get() != NULL) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2336 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2337 scene.SetLayer(LAYER_DEEP_LEARNING, deepLearningLayer.release()); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2338 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2339 else |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2340 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2341 scene.DeleteLayer(LAYER_DEEP_LEARNING); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2342 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
2343 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2344 stoneAnnotations_->Render(scene); // Necessary for "FitContent()" to work |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2345 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2346 if (fitNextContent_) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2347 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2348 lock->RefreshCanvasSize(); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2349 lock->GetCompositor().FitContent(scene); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2350 stoneAnnotations_->Render(scene); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2351 fitNextContent_ = false; |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2352 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2353 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2354 //lock->GetCompositor().Refresh(scene); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2355 lock->Invalidate(); |
1668 | 2356 } |
2357 } | |
2358 | |
2359 | |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2360 void RenderCurrentSceneFromCommand(const Orthanc::ImageAccessor& frame, |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2361 const std::string& loadedSopInstanceUid, |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2362 unsigned int loadedFrameNumber, |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2363 DisplayedFrameQuality quality) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2364 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2365 if (cursor_.get() != NULL && |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2366 frames_.get() != NULL) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2367 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2368 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2369 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2370 const unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2371 |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2372 // Only change the scene if the loaded frame still corresponds to the current cursor |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2373 if (instance.GetSopInstanceUid() == loadedSopInstanceUid && |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2374 frameNumber == loadedFrameNumber) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2375 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2376 const OrthancStone::CoordinateSystem3D plane = frames_->GetFrameGeometry(cursorIndex); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2377 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2378 if (quality == DisplayedFrameQuality_Low) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2379 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2380 FramesCache::Accessor accessor(*framesCache_, instance.GetSopInstanceUid(), frameNumber); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2381 if (accessor.IsValid() && |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2382 accessor.GetQuality() == QUALITY_FULL) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2383 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2384 // A high-res image was downloaded in between: Use this cached image instead of the low-res |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2385 RenderCurrentScene(accessor.GetImage(), instance, frameNumber, plane); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2386 SetupPrefetchAfterRendering(frame, DisplayedFrameQuality_High); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2387 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2388 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2389 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2390 // This frame is only available in low-res: Download the full DICOM |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2391 RenderCurrentScene(frame, instance, frameNumber, plane); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2392 SetupPrefetchAfterRendering(frame, quality); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2393 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2394 /** |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2395 * The command "SetupPrefetchAfterRendering()" must be |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2396 * after "SetupPrefetchAfterRendering(quality)", as the |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2397 * DICOM instance might already be cached by the oracle, |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2398 * which makes a call to "observer_->SignalFrameUpdated()" |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2399 * with a low quality, whereas the high quality is |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2400 * available. |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2401 **/ |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2402 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2403 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2404 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2405 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2406 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2407 assert(quality == DisplayedFrameQuality_High); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2408 SetupPrefetchAfterRendering(frame, quality); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2409 RenderCurrentScene(frame, instance, frameNumber, plane); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2410 } |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2411 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2412 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2413 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2414 |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2415 void ScheduleLoadFullDicomFrame(const std::string& sopInstanceUid, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2416 unsigned int frameNumber, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2417 int priority, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2418 bool isPrefetch) |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2419 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2420 if (frames_.get() != NULL) |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2421 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2422 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock()); |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2423 lock->Schedule( |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2424 GetSharedObserver(), priority, OrthancStone::ParseDicomFromWadoCommand::Create( |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2425 source_, frames_->GetStudyInstanceUid(), frames_->GetSeriesInstanceUid(), |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2426 sopInstanceUid, serverSideTranscoding_, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2427 Orthanc::DicomTransferSyntax_LittleEndianExplicit, |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2428 new SetFullDicomFrame(GetSharedObserver(), sopInstanceUid, frameNumber, priority, isPrefetch, serverSideTranscoding_))); |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2429 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2430 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2431 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2432 void ScheduleLoadFullDicomFrame(size_t cursorIndex, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2433 int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2434 bool isPrefetch) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2435 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2436 if (frames_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2437 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2438 std::string sopInstanceUid = frames_->GetInstanceOfFrame(cursorIndex).GetSopInstanceUid(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2439 unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2440 ScheduleLoadFullDicomFrame(sopInstanceUid, frameNumber, priority, isPrefetch); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2441 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2442 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2443 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2444 void ScheduleLoadRenderedFrame(size_t cursorIndex, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2445 int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2446 bool isPrefetch) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2447 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2448 if (!source_.HasDicomWebRendered()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2449 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2450 ScheduleLoadFullDicomFrame(cursorIndex, priority, isPrefetch); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2451 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2452 else if (frames_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2453 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2454 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2455 unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2456 |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2457 /** |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2458 * If the full-resolution DICOM file is already available in the |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2459 * cache of the oracle, bypass the loading of the "rendered" and |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2460 * use the cached DICOM file. |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2461 **/ |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2462 std::unique_ptr<OrthancStone::WebAssemblyOracle::CachedInstanceAccessor> accessor( |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2463 context_.AccessCachedInstance(instance.GetSopInstanceUid())); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2464 |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2465 if (accessor.get() != NULL && |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2466 accessor->IsValid()) |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2467 { |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2468 try |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2469 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2470 std::unique_ptr<Orthanc::ImageAccessor> frame(accessor->GetDicom().DecodeFrame(frameNumber)); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2471 SetFullDicomFrame::Apply(*this, accessor->GetDicom(), frame.release(), instance.GetSopInstanceUid(), frameNumber); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2472 return; // Success |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2473 } |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2474 catch (Orthanc::OrthancException&) |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2475 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2476 /** |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2477 * This happens if the cached DICOM file uses a transfer |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2478 * syntax that is not supported by DCMTK (such as |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2479 * JPEG2k). Fallback to "/rendered" in order to re-download |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2480 * the DICOM file using server-side transcoding. This |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2481 * happens on WRIX dataset. |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2482 **/ |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2483 } |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2484 } |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2485 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2486 bool isMonochrome1 = (instance.GetImageInformation().GetPhotometricInterpretation() == |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2487 Orthanc::PhotometricInterpretation_Monochrome1); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2488 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2489 const std::string uri = ("studies/" + frames_->GetStudyInstanceUid() + |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2490 "/series/" + frames_->GetSeriesInstanceUid() + |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2491 "/instances/" + instance.GetSopInstanceUid() + |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2492 "/frames/" + boost::lexical_cast<std::string>(frameNumber + 1) + "/rendered"); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2493 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2494 std::map<std::string, std::string> headers, arguments; |
1717
391c798e4dae
fix for KNIX sample dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1714
diff
changeset
|
2495 // arguments["quality"] = "10"; // Low-level quality for test purpose |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2496 arguments["window"] = ( |
1536 | 2497 boost::lexical_cast<std::string>(windowingCenter_) + "," + |
2498 boost::lexical_cast<std::string>(windowingWidth_) + ",linear"); | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2499 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2500 std::unique_ptr<OrthancStone::IOracleCommand> command( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2501 source_.CreateDicomWebCommand( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2502 uri, arguments, headers, new SetLowQualityFrame( |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2503 GetSharedObserver(), instance.GetSopInstanceUid(), frameNumber, |
1536 | 2504 windowingCenter_, windowingWidth_, isMonochrome1, isPrefetch))); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2505 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2506 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2507 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2508 lock->Schedule(GetSharedObserver(), priority, command.release()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2509 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2510 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2511 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2512 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2513 void UpdateCurrentTextureParameters() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2514 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2515 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2516 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2517 if (lock->GetController().GetScene().HasLayer(LAYER_TEXTURE)) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2518 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2519 if (lock->GetController().GetScene().GetLayer(LAYER_TEXTURE).GetType() == |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2520 OrthancStone::ISceneLayer::Type_FloatTexture) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2521 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2522 dynamic_cast<OrthancStone::FloatTextureSceneLayer&>( |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2523 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)). |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2524 SetCustomWindowing(windowingCenter_, windowingWidth_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2525 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2526 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2527 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2528 OrthancStone::TextureBaseSceneLayer& layer = |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2529 dynamic_cast<OrthancStone::TextureBaseSceneLayer&>( |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2530 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2531 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2532 layer.SetFlipX(flipX_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2533 layer.SetFlipY(flipY_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2534 } |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2535 |
1925 | 2536 if (lock->GetController().GetScene().HasLayer(LAYER_OVERLAY)) |
1924
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2537 { |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2538 OrthancStone::TextureBaseSceneLayer& layer = |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2539 dynamic_cast<OrthancStone::TextureBaseSceneLayer&>( |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2540 lock->GetController().GetScene().GetLayer(LAYER_OVERLAY)); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2541 |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2542 layer.SetFlipX(flipX_); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2543 layer.SetFlipY(flipY_); |
f4050908c6bc
display of overlays
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1916
diff
changeset
|
2544 } |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2545 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2546 lock->Invalidate(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2547 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2548 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2549 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2550 |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2551 ViewerViewport(OrthancStone::WebAssemblyLoadersContext& context, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2552 const OrthancStone::DicomSource& source, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2553 const std::string& canvas, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2554 boost::shared_ptr<FramesCache> cache, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2555 bool softwareRendering) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2556 context_(context), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2557 source_(source), |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2558 framesCache_(cache), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2559 fitNextContent_(true), |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2560 flipX_(false), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2561 flipY_(false), |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2562 hasFocusOnInstance_(false), |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2563 focusFrameNumber_(0), |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2564 synchronizationOffset_(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0)), |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2565 synchronizationEnabled_(false), |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2566 centralPhysicalWidth_(1), |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2567 centralPhysicalHeight_(1), |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2568 centralPixelSpacingX_(1), |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2569 centralPixelSpacingY_(1) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2570 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2571 if (!framesCache_) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2572 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2573 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2574 } |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2575 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2576 if (softwareRendering) |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2577 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2578 LOG(INFO) << "Creating Cairo viewport in canvas: " << canvas; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2579 viewport_ = OrthancStone::WebAssemblyCairoViewport::Create(canvas); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2580 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2581 else |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2582 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2583 LOG(INFO) << "Creating WebGL viewport in canvas: " << canvas; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2584 viewport_ = OrthancStone::WebGLViewport::Create(canvas); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2585 } |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2586 |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2587 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2588 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2589 std::string ttf; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2590 Orthanc::EmbeddedResources::GetFileResource(ttf, Orthanc::EmbeddedResources::UBUNTU_FONT); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2591 lock->GetCompositor().SetFont(0, ttf, 16 /* font size */, Orthanc::Encoding_Latin1); |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2592 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2593 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2594 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, OnWheel); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2595 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2596 SetWindowingPreset(); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2597 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2598 stoneAnnotations_.reset(new OrthancStone::AnnotationsSceneLayer(LAYER_ANNOTATIONS_STONE)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2599 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2600 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2601 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2602 void Handle(const OrthancStone::ViewportController::GrayscaleWindowingChanged& message) |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2603 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2604 // This event is triggered by the windowing mouse action, from class "GrayscaleWindowingSceneTracker" |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2605 windowingCenter_ = message.GetWindowingCenter(); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2606 windowingWidth_ = message.GetWindowingWidth(); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2607 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2608 if (observer_.get() != NULL) |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2609 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2610 observer_->SignalWindowingUpdated(*this, message.GetWindowingCenter(), message.GetWindowingWidth()); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2611 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2612 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2613 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2614 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2615 static EM_BOOL OnWheel(int eventType, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2616 const EmscriptenWheelEvent *wheelEvent, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2617 void *userData) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2618 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2619 ViewerViewport& that = *reinterpret_cast<ViewerViewport*>(userData); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2620 |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2621 if (that.frames_.get() != NULL && |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2622 that.cursor_.get() != NULL) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2623 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2624 const bool isCtrl = wheelEvent->mouse.ctrlKey; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2625 const bool isShift = wheelEvent->mouse.shiftKey; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2626 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2627 const size_t previousCursorIndex = that.cursor_->GetCurrentIndex(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2628 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2629 if (wheelEvent->deltaY < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2630 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2631 that.ChangeFrame(isCtrl ? SeriesCursor::Action_FastMinus : |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2632 SeriesCursor::Action_Minus, false /* not circular */); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2633 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2634 else if (wheelEvent->deltaY > 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2635 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2636 that.ChangeFrame(isCtrl ? SeriesCursor::Action_FastPlus : |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2637 SeriesCursor::Action_Plus, false /* not circular */); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2638 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2639 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2640 if (that.synchronizationEnabled_) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2641 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2642 const size_t currentCursorIndex = that.cursor_->GetCurrentIndex(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2643 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2644 const OrthancStone::CoordinateSystem3D current = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2645 that.frames_->GetFrameGeometry(currentCursorIndex); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2646 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2647 if (isShift && |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2648 previousCursorIndex != currentCursorIndex) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2649 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2650 const OrthancStone::CoordinateSystem3D previous = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2651 that.frames_->GetFrameGeometry(previousCursorIndex); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2652 that.synchronizationOffset_ += previous.GetOrigin() - current.GetOrigin(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2653 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2654 |
1694 | 2655 that.observer_->SignalSynchronizedBrowsing( |
2656 that, current.GetOrigin() + that.synchronizationOffset_, current.GetNormal()); | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2657 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2658 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2659 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2660 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2661 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2662 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2663 void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2664 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2665 dynamic_cast<const ICommand&>(message.GetUserPayload()).Handle(message); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2666 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2667 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2668 void Handle(const OrthancStone::HttpCommand::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2669 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2670 dynamic_cast<const ICommand&>(message.GetOrigin().GetPayload()).Handle(message); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2671 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2672 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2673 void Handle(const OrthancStone::ParseDicomSuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2674 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2675 dynamic_cast<const ICommand&>(message.GetOrigin().GetPayload()).Handle(message); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2676 } |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2677 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2678 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2679 void RefreshAnnotations(bool save) |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2680 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2681 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2682 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2683 stoneAnnotations_->Render(lock->GetController().GetScene()); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2684 lock->Invalidate(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2685 } |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2686 |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2687 if (save) |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2688 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2689 if (cursor_.get() != NULL && |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2690 frames_.get() != NULL) |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2691 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2692 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2693 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2694 const unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2695 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2696 StoneAnnotationsRegistry::GetInstance().Save(instance.GetSopInstanceUid(), frameNumber, *stoneAnnotations_); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2697 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2698 if (observer_.get() != NULL) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2699 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2700 observer_->SignalStoneAnnotationsChanged(*this, instance.GetSopInstanceUid(), frameNumber); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2701 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2702 } |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2703 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2704 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2705 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2706 void Handle(const OrthancStone::ViewportController::SceneTransformChanged& message) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2707 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2708 RefreshAnnotations(false /* don't save */); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2709 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2710 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2711 void Handle(const OrthancStone::AnnotationsSceneLayer::AnnotationChangedMessage& message) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2712 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2713 RefreshAnnotations(true /* save */); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2714 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2715 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2716 void Handle(const OrthancStone::AnnotationsSceneLayer::AnnotationAddedMessage& message) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2717 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2718 RefreshAnnotations(true /* save */); |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2719 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2720 if (observer_.get() != NULL) |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2721 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2722 observer_->SignalStoneAnnotationAdded(*this); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2723 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2724 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2725 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2726 void Handle(const OrthancStone::AnnotationsSceneLayer::AnnotationRemovedMessage& message) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2727 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2728 RefreshAnnotations(true /* save */); |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2729 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2730 if (observer_.get() != NULL) |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2731 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2732 observer_->SignalStoneAnnotationRemoved(*this); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2733 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2734 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2735 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2736 public: |
1622
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2737 virtual ~ViewerViewport() |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2738 { |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2739 // Unregister the callbacks to avoid any call with a "void*" that |
1623
74be0f498b08
Updated mechanism to avoid using deleted objects in RequestAnimationFrame callbacks.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1622
diff
changeset
|
2740 // has been destroyed. "WebAssemblyViewport::CreateObjectCookie()" |
1622
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2741 // provides a more advanced alternative. |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2742 emscripten_set_wheel_callback(viewport_->GetCanvasCssSelector().c_str(), this, true, NULL); |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2743 } |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2744 |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2745 static boost::shared_ptr<ViewerViewport> Create(OrthancStone::WebAssemblyLoadersContext& context, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2746 const OrthancStone::DicomSource& source, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2747 const std::string& canvas, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2748 boost::shared_ptr<FramesCache> cache, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2749 bool softwareRendering) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2750 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2751 boost::shared_ptr<ViewerViewport> viewport( |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2752 new ViewerViewport(context, source, canvas, cache, softwareRendering)); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2753 |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2754 { |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2755 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context.Lock()); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2756 |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2757 viewport->loader_ = OrthancStone::DicomResourcesLoader::Create(*lock); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2758 viewport->Register<OrthancStone::DicomResourcesLoader::SuccessMessage>( |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2759 *viewport->loader_, &ViewerViewport::Handle); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2760 |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2761 viewport->Register<OrthancStone::HttpCommand::SuccessMessage>( |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2762 lock->GetOracleObservable(), &ViewerViewport::Handle); |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2763 |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2764 viewport->Register<OrthancStone::ParseDicomSuccessMessage>( |
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2765 lock->GetOracleObservable(), &ViewerViewport::Handle); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2766 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2767 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationChangedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2768 *viewport->stoneAnnotations_, &ViewerViewport::Handle); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2769 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2770 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationAddedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2771 *viewport->stoneAnnotations_, &ViewerViewport::Handle); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2772 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2773 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationRemovedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2774 *viewport->stoneAnnotations_, &ViewerViewport::Handle); |
1675
6fa05252b085
don't load low-quality image if the parsed dicom file is cached by the oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1674
diff
changeset
|
2775 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2776 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2777 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2778 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport->viewport_->Lock()); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2779 viewport->Register<OrthancStone::ViewportController::GrayscaleWindowingChanged>(lock->GetController(), &ViewerViewport::Handle); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2780 viewport->Register<OrthancStone::ViewportController::SceneTransformChanged>(lock->GetController(), &ViewerViewport::Handle); |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2781 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2782 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2783 return viewport; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2784 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2785 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2786 void SetFrames(OrthancStone::SortedFrames* frames) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2787 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2788 if (frames == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2789 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2790 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2791 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2792 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2793 flipX_ = false; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2794 flipY_ = false; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2795 fitNextContent_ = true; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2796 cineRate_ = DEFAULT_CINE_RATE; |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2797 inverted_ = false; |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2798 serverSideTranscoding_ = false; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2799 OrthancStone::LinearAlgebra::AssignVector(synchronizationOffset_, 0, 0, 0); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2800 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2801 frames_.reset(frames); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2802 cursor_.reset(new SeriesCursor(frames_->GetFramesCount())); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2803 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2804 LOG(INFO) << "Number of frames in series: " << frames_->GetFramesCount(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2805 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2806 SetWindowingPreset(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2807 ClearViewport(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2808 prefetchQueue_.clear(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2809 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2810 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2811 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2812 observer_->SignalFrameUpdated(*this, cursor_->GetCurrentIndex(), |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
2813 frames_->GetFramesCount(), DisplayedFrameQuality_None, 0, "", ""); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2814 } |
1665
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2815 |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2816 centralPhysicalWidth_ = 1; |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2817 centralPhysicalHeight_ = 1; |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2818 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2819 if (frames_->GetFramesCount() != 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2820 { |
1665
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2821 const OrthancStone::DicomInstanceParameters& centralInstance = frames_->GetInstanceOfFrame(cursor_->GetCurrentIndex()); |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2822 |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2823 /** |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2824 * Avoid loading metadata if we know that this cannot be a |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2825 * "true" image with pixel data. Retrieving instance metadata on |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2826 * RTSTRUCT can lead to very large JSON whose parsing will |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2827 * freeze the browser for several seconds. |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2828 **/ |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2829 const OrthancStone::SopClassUid uid = centralInstance.GetSopClassUid(); |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2830 if (uid != OrthancStone::SopClassUid_EncapsulatedPdf && |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2831 uid != OrthancStone::SopClassUid_RTDose && |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2832 uid != OrthancStone::SopClassUid_RTPlan && |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2833 uid != OrthancStone::SopClassUid_RTStruct && |
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2834 GetSeriesThumbnailType(uid) != OrthancStone::SeriesThumbnailType_Video) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2835 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2836 // Fetch the details of the series from the central instance |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2837 const std::string uri = ("studies/" + frames_->GetStudyInstanceUid() + |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2838 "/series/" + frames_->GetSeriesInstanceUid() + |
1665
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
2839 "/instances/" + centralInstance.GetSopInstanceUid() + "/metadata"); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2840 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2841 loader_->ScheduleGetDicomWeb( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2842 boost::make_shared<OrthancStone::LoadedDicomResources>(Orthanc::DICOM_TAG_SOP_INSTANCE_UID), |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2843 0, source_, uri, new LoadSeriesDetailsFromInstance(GetSharedObserver())); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2844 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2845 } |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2846 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2847 ApplyScheduledFocus(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2848 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2849 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2850 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2851 // This method is used when the layout of the HTML page changes, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2852 // which does not trigger the "emscripten_set_resize_callback()" |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2853 void UpdateSize(bool fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2854 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2855 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
1576
92fca2b3ba3d
sanitizing the handling of canvas size
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1575
diff
changeset
|
2856 lock->RefreshCanvasSize(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2857 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2858 if (fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2859 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2860 lock->GetCompositor().FitContent(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2861 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2862 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2863 stoneAnnotations_->ClearHover(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2864 stoneAnnotations_->Render(lock->GetController().GetScene()); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2865 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2866 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2867 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2868 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2869 void AcquireObserver(IObserver* observer) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2870 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2871 observer_.reset(observer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2872 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2873 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2874 const std::string& GetCanvasId() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2875 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2876 assert(viewport_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2877 return viewport_->GetCanvasId(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2878 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2879 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2880 |
1668 | 2881 void Redraw() |
2882 { | |
2883 if (cursor_.get() != NULL && | |
2884 frames_.get() != NULL) | |
2885 { | |
2886 const size_t cursorIndex = cursor_->GetCurrentIndex(); | |
2887 | |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2888 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
2889 const unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2890 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2891 FramesCache::Accessor accessor(*framesCache_, instance.GetSopInstanceUid(), frameNumber); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2892 if (accessor.IsValid()) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2893 { |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2894 RenderCurrentScene(accessor.GetImage(), instance, frameNumber, frames_->GetFrameGeometry(cursorIndex)); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2895 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2896 DisplayedFrameQuality quality; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2897 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2898 if (accessor.GetQuality() < QUALITY_FULL) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2899 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2900 // This frame is only available in low-res: Download the full DICOM |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2901 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2902 quality = DisplayedFrameQuality_Low; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2903 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2904 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2905 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2906 quality = DisplayedFrameQuality_High; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2907 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2908 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2909 SetupPrefetchAfterRendering(accessor.GetImage(), quality); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2910 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2911 else |
1668 | 2912 { |
2913 // This frame is not cached yet: Load it | |
2914 if (source_.HasDicomWebRendered()) | |
2915 { | |
2916 ScheduleLoadRenderedFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); | |
2917 } | |
2918 else | |
2919 { | |
2920 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); | |
2921 } | |
2922 } | |
2923 } | |
2924 } | |
2925 | |
2926 | |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2927 // Returns "true" iff the frame has indeed changed |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2928 bool ChangeFrame(SeriesCursor::Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2929 bool isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2930 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2931 if (cursor_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2932 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2933 size_t previous = cursor_->GetCurrentIndex(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2934 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2935 cursor_->Apply(action, isCircular); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2936 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2937 size_t current = cursor_->GetCurrentIndex(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2938 if (previous != current) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2939 { |
1668 | 2940 Redraw(); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2941 return true; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2942 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2943 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2944 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2945 return false; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2946 } |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2947 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2948 |
1948
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2949 void SetFrame(unsigned int frameNumber) |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2950 { |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2951 if (cursor_.get() != NULL && |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2952 frameNumber < cursor_->GetFramesCount() && |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2953 frameNumber != cursor_->GetCurrentIndex()) |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2954 { |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2955 cursor_->SetCurrentIndex(frameNumber); |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2956 Redraw(); |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2957 } |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2958 } |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2959 |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
2960 |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2961 void GoToFirstFrame() |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2962 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2963 if (cursor_.get() != NULL && |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2964 cursor_->GetCurrentIndex() != 0) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2965 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2966 cursor_->SetCurrentIndex(0); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2967 Redraw(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2968 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2969 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2970 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2971 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2972 void GoToLastFrame() |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2973 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2974 if (cursor_.get() != NULL) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2975 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2976 size_t last = cursor_->GetFramesCount() - 1; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2977 if (cursor_->GetCurrentIndex() != last) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2978 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2979 cursor_->SetCurrentIndex(last); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2980 Redraw(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2981 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2982 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2983 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2984 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2985 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2986 bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2987 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2988 if (cursor_.get() != NULL && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2989 frames_.get() != NULL) |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2990 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2991 frameOfReferenceUid = frames_->GetInstanceOfFrame(cursor_->GetCurrentIndex()).GetFrameOfReferenceUid(); |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2992 return true; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2993 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2994 else |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2995 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2996 return false; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2997 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2998 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2999 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3000 bool GetCurrentPlane(OrthancStone::CoordinateSystem3D& plane) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3001 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3002 if (cursor_.get() != NULL && |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3003 frames_.get() != NULL) |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3004 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3005 plane = frames_->GetFrameGeometry(cursor_->GetCurrentIndex()); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3006 return true; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3007 } |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3008 else |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3009 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3010 return false; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3011 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3012 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3013 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3014 void UpdateReferenceLines(const std::list<const ViewerViewport*>& viewports) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3015 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3016 std::unique_ptr<OrthancStone::PolylineSceneLayer> layer(new OrthancStone::PolylineSceneLayer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3017 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3018 if (cursor_.get() != NULL && |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3019 frames_.get() != NULL) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3020 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3021 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3022 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3023 const unsigned int frame = frames_->GetFrameNumberInInstance(cursorIndex); |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3024 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3025 for (std::list<const ViewerViewport*>::const_iterator |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3026 it = viewports.begin(); it != viewports.end(); ++it) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3027 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3028 assert(*it != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3029 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3030 OrthancStone::CoordinateSystem3D otherPlane; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3031 std::string otherFrameOfReferenceUid; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3032 if ((*it)->GetCurrentPlane(otherPlane) && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3033 (*it)->GetCurrentFrameOfReferenceUid(otherFrameOfReferenceUid) && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3034 otherFrameOfReferenceUid == instance.GetFrameOfReferenceUid()) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3035 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3036 double x1, y1, x2, y2; |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3037 if (GetReferenceLineCoordinates(x1, y1, x2, y2, instance, frame, otherPlane)) |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3038 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3039 OrthancStone::PolylineSceneLayer::Chain chain; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3040 chain.push_back(OrthancStone::ScenePoint2D(x1, y1)); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3041 chain.push_back(OrthancStone::ScenePoint2D(x2, y2)); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3042 layer->AddChain(chain, false, 0, 255, 0); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3043 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3044 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3045 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3046 } |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3047 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3048 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3049 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3050 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3051 if (layer->GetChainsCount() == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3052 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3053 lock->GetController().GetScene().DeleteLayer(LAYER_REFERENCE_LINES); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3054 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3055 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3056 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3057 lock->GetController().GetScene().SetLayer(LAYER_REFERENCE_LINES, layer.release()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3058 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3059 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3060 //lock->GetCompositor().Refresh(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3061 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3062 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3063 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3064 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3065 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3066 void ClearReferenceLines() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3067 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3068 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3069 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3070 lock->GetController().GetScene().DeleteLayer(LAYER_REFERENCE_LINES); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3071 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3072 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3073 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3074 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3075 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3076 void SetWindowingPreset() |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3077 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3078 assert(windowingPresetCenters_.size() == windowingPresetWidths_.size()); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3079 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3080 if (windowingPresetCenters_.empty()) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3081 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3082 SetWindowing(128, 256); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3083 } |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3084 else |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3085 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3086 SetWindowing(windowingPresetCenters_[0], windowingPresetWidths_[0]); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3087 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3088 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3089 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3090 void SetWindowing(float windowingCenter, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3091 float windowingWidth) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3092 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3093 windowingCenter_ = windowingCenter; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3094 windowingWidth_ = windowingWidth; |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3095 UpdateCurrentTextureParameters(); |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3096 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3097 if (observer_.get() != NULL) |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3098 { |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3099 observer_->SignalWindowingUpdated(*this, windowingCenter, windowingWidth); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3100 } |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3101 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3102 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3103 void FlipX() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3104 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3105 flipX_ = !flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3106 UpdateCurrentTextureParameters(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3107 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3108 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3109 void FlipY() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3110 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3111 flipY_ = !flipY_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3112 UpdateCurrentTextureParameters(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3113 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3114 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3115 void Invert() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3116 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3117 inverted_ = !inverted_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3118 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3119 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3120 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3121 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3122 if (lock->GetController().GetScene().HasLayer(LAYER_TEXTURE) && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3123 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE).GetType() == |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3124 OrthancStone::ISceneLayer::Type_FloatTexture) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3125 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3126 OrthancStone::FloatTextureSceneLayer& layer = |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3127 dynamic_cast<OrthancStone::FloatTextureSceneLayer&>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3128 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3129 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3130 // NB: Using "IsInverted()" instead of "inverted_" is for |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3131 // compatibility with MONOCHROME1 images |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3132 layer.SetInverted(!layer.IsInverted()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3133 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3134 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3135 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3136 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3137 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3138 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3139 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3140 class Interactor : public OrthancStone::DefaultViewportInteractor |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3141 { |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3142 private: |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3143 ViewerViewport& viewer_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3144 WebViewerAction leftAction_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3145 WebViewerAction middleAction_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3146 WebViewerAction rightAction_; |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3147 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3148 bool IsAction(const OrthancStone::PointerEvent& event, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3149 WebViewerAction action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3150 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3151 switch (event.GetMouseButton()) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3152 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3153 case OrthancStone::MouseButton_Left: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3154 return (leftAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3155 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3156 case OrthancStone::MouseButton_Middle: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3157 return (middleAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3158 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3159 case OrthancStone::MouseButton_Right: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3160 return (rightAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3161 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3162 default: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3163 return false; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3164 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3165 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3166 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3167 public: |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3168 Interactor(ViewerViewport& viewer, |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3169 WebViewerAction leftAction, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3170 WebViewerAction middleAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3171 WebViewerAction rightAction) : |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3172 viewer_(viewer), |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3173 leftAction_(leftAction), |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3174 middleAction_(middleAction), |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3175 rightAction_(rightAction) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3176 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3177 SetLeftButtonAction(ConvertWebViewerAction(leftAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3178 SetMiddleButtonAction(ConvertWebViewerAction(middleAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3179 SetRightButtonAction(ConvertWebViewerAction(rightAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3180 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3181 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3182 virtual OrthancStone::IFlexiblePointerTracker* CreateTracker( |
1607 | 3183 boost::weak_ptr<OrthancStone::IViewport> viewport, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3184 const OrthancStone::PointerEvent& event, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3185 unsigned int viewportWidth, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3186 unsigned int viewportHeight) ORTHANC_OVERRIDE |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3187 { |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3188 boost::shared_ptr<OrthancStone::IViewport> lock1(viewport.lock()); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3189 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3190 if (lock1 && |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3191 IsAction(event, WebViewerAction_Crosshair)) |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3192 { |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3193 OrthancStone::CoordinateSystem3D plane; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3194 if (viewer_.GetCurrentPlane(plane)) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3195 { |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3196 std::unique_ptr<OrthancStone::IViewport::ILock> lock2(lock1->Lock()); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3197 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3198 const OrthancStone::ScenePoint2D p = event.GetMainPosition(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3199 double x = p.GetX(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3200 double y = p.GetY(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3201 lock2->GetController().GetCanvasToSceneTransform().Apply(x, y); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3202 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3203 OrthancStone::Vector click = plane.MapSliceToWorldCoordinates(x, y); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3204 if (viewer_.observer_.get() != NULL) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3205 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3206 viewer_.observer_->SignalCrosshair(viewer_, click); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3207 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3208 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3209 |
1580 | 3210 return NULL; // No need for a tracker, this is just a click |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3211 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3212 else |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3213 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3214 // Only the left mouse button can be used to edit/create/remove annotations |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3215 if (event.GetMouseButton() == OrthancStone::MouseButton_Left) |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3216 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3217 switch (leftAction_) |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3218 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3219 case WebViewerAction_CreateAngle: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3220 viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Angle); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3221 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3222 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3223 case WebViewerAction_CreateCircle: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3224 viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Circle); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3225 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3226 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3227 case WebViewerAction_CreateSegment: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3228 viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Segment); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3229 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3230 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3231 case WebViewerAction_RemoveMeasure: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3232 viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Remove); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3233 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3234 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3235 default: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3236 viewer_.stoneAnnotations_->SetActiveTool(OrthancStone::AnnotationsSceneLayer::Tool_Edit); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3237 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3238 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3239 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3240 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3241 std::unique_ptr<OrthancStone::IViewport::ILock> lock2(lock1->Lock()); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3242 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3243 std::unique_ptr<OrthancStone::IFlexiblePointerTracker> t; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3244 t.reset(viewer_.stoneAnnotations_->CreateTracker(event.GetMainPosition(), lock2->GetController().GetScene())); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3245 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3246 if (t.get() != NULL) |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3247 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3248 return t.release(); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3249 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3250 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3251 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3252 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3253 return DefaultViewportInteractor::CreateTracker( |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3254 viewport, event, viewportWidth, viewportHeight); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3255 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3256 } |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3257 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3258 virtual bool HasMouseHover() const ORTHANC_OVERRIDE |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3259 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3260 return true; |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3261 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3262 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3263 virtual void HandleMouseHover(OrthancStone::IViewport& viewport, |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3264 const OrthancStone::PointerEvent& event) ORTHANC_OVERRIDE |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3265 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3266 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport.Lock()); |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3267 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3268 if (viewer_.stoneAnnotations_->SetMouseHover(event.GetMainPosition(), lock->GetController().GetScene())) |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3269 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3270 viewer_.stoneAnnotations_->Render(lock->GetController().GetScene()); |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3271 lock->Invalidate(); |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3272 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3273 } |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3274 }; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3275 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3276 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3277 void SetMouseButtonActions(WebViewerAction leftAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3278 WebViewerAction middleAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3279 WebViewerAction rightAction) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3280 { |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3281 assert(viewport_ != NULL); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3282 viewport_->AcquireInteractor(new Interactor(*this, leftAction, middleAction, rightAction)); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3283 } |
1575 | 3284 |
1578 | 3285 void FitForPrint() |
1575 | 3286 { |
3287 viewport_->FitForPrint(); | |
3288 } | |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3289 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3290 void SetOsiriXAnnotations(boost::shared_ptr<OrthancStone::OsiriX::CollectionOfAnnotations> annotations) |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3291 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3292 osiriXAnnotations_ = annotations; |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3293 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3294 |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3295 void ScheduleFrameFocus(const std::string& sopInstanceUid, |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3296 unsigned int frameNumber) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3297 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3298 hasFocusOnInstance_ = true; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3299 focusSopInstanceUid_ = sopInstanceUid; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3300 focusFrameNumber_ = frameNumber; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3301 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3302 ApplyScheduledFocus(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3303 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3304 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3305 void ApplyScheduledFocus() |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3306 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3307 size_t cursorIndex; |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3308 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3309 if (hasFocusOnInstance_ && |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3310 cursor_.get() != NULL && |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3311 frames_.get() != NULL && |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3312 frames_->LookupFrame(cursorIndex, focusSopInstanceUid_, focusFrameNumber_)) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3313 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3314 size_t current = cursor_->GetCurrentIndex(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3315 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3316 if (current != cursorIndex) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3317 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3318 cursor_->SetCurrentIndex(cursorIndex); |
1668 | 3319 Redraw(); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3320 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3321 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3322 hasFocusOnInstance_ = false; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3323 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3324 } |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3325 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3326 void FocusOnPoint(const OrthancStone::Vector& p) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3327 { |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3328 //static const double MAX_DISTANCE = 0.5; // 0.5 cm => TODO parameter? |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3329 static const double MAX_DISTANCE = std::numeric_limits<double>::infinity(); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3330 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3331 size_t cursorIndex; |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3332 if (cursor_.get() != NULL && |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3333 frames_.get() != NULL && |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3334 frames_->FindClosestFrame(cursorIndex, p, MAX_DISTANCE)) |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3335 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3336 cursor_->SetCurrentIndex(cursorIndex); |
1668 | 3337 Redraw(); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3338 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3339 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3340 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3341 unsigned int GetCineRate() const |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3342 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3343 return cineRate_; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3344 } |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3345 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3346 void FormatWindowingPresets(Json::Value& target) const |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3347 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3348 assert(windowingPresetCenters_.size() == windowingPresetWidths_.size()); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3349 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3350 target = Json::arrayValue; |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3351 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3352 for (size_t i = 0; i < windowingPresetCenters_.size(); i++) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3353 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3354 const float c = windowingPresetCenters_[i]; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3355 const float w = windowingPresetWidths_[i]; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3356 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3357 std::string name = "Preset"; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3358 if (windowingPresetCenters_.size() > 1) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3359 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3360 name += " " + boost::lexical_cast<std::string>(i + 1); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3361 } |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3362 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3363 Json::Value preset = Json::objectValue; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3364 preset["name"] = name; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3365 preset["center"] = c; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3366 preset["width"] = w; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3367 preset["info"] = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3368 ("C " + boost::lexical_cast<std::string>(static_cast<int>(boost::math::iround<double>(c))) + |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3369 ", W " + boost::lexical_cast<std::string>(static_cast<int>(boost::math::iround<double>(w)))); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3370 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3371 target.append(preset); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3372 } |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3373 } |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3374 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3375 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3376 void SetSynchronizedBrowsingEnabled(int enabled) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3377 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3378 OrthancStone::LinearAlgebra::AssignVector(synchronizationOffset_, 0, 0, 0); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3379 synchronizationEnabled_ = enabled; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3380 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3381 |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3382 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3383 void SignalStoneAnnotationsChanged(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3384 size_t frame) |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3385 { |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3386 if (cursor_.get() != NULL && |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3387 frames_.get() != NULL) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3388 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3389 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3390 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3391 const unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3392 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3393 if (instance.GetSopInstanceUid() == sopInstanceUid && |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3394 frameNumber == frame) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3395 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3396 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frame); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3397 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3398 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3399 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3400 stoneAnnotations_->Render(lock->GetController().GetScene()); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3401 lock->Invalidate(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3402 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3403 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3404 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3405 } |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3406 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3407 |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3408 bool GetCurrentFrame(std::string& sopInstanceUid /* out */, |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3409 unsigned int& frameNumber /* out */) const |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3410 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3411 if (cursor_.get() != NULL && |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3412 frames_.get() != NULL) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3413 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3414 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3415 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3416 sopInstanceUid = instance.GetSopInstanceUid(); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3417 frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3418 return true; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3419 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3420 else |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3421 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3422 return false; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3423 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3424 } |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3425 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3426 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3427 void SetDeepLearningMask(const std::string& sopInstanceUid, |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3428 unsigned int frameNumber, |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3429 const Orthanc::ImageAccessor& mask) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3430 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3431 std::string currentSopInstanceUid; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3432 unsigned int currentFrameNumber; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3433 if (GetCurrentFrame(currentSopInstanceUid, currentFrameNumber) && |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3434 sopInstanceUid == currentSopInstanceUid && |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3435 frameNumber == currentFrameNumber) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3436 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3437 deepLearningSopInstanceUid_ = sopInstanceUid; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3438 deepLearningFrameNumber_ = frameNumber; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3439 deepLearningMask_.reset(Orthanc::Image::Clone(mask)); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3440 Redraw(); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3441 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3442 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3443 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3444 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3445 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3446 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3447 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3448 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3449 typedef std::map<std::string, boost::shared_ptr<ViewerViewport> > Viewports; |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3450 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3451 static Viewports allViewports_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3452 static bool showReferenceLines_ = true; |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3453 static boost::shared_ptr<OrthancStone::OsiriX::CollectionOfAnnotations> osiriXAnnotations_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3454 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3455 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3456 static void UpdateReferenceLines() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3457 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3458 if (showReferenceLines_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3459 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3460 std::list<const ViewerViewport*> viewports; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3461 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3462 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3463 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3464 assert(it->second != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3465 viewports.push_back(it->second.get()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3466 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3467 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3468 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3469 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3470 assert(it->second != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3471 it->second->UpdateReferenceLines(viewports); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3472 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3473 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3474 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3475 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3476 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3477 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3478 assert(it->second != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3479 it->second->ClearReferenceLines(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3480 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3481 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3482 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3483 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3484 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3485 class WebAssemblyObserver : public ResourcesLoader::IObserver, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3486 public ViewerViewport::IObserver |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3487 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3488 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3489 virtual void SignalResourcesLoaded() ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3490 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3491 DISPATCH_JAVASCRIPT_EVENT("ResourcesLoaded"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3492 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3493 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3494 virtual void SignalSeriesThumbnailLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3495 const std::string& seriesInstanceUid) ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3496 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3497 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3498 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3499 customEvent.initCustomEvent("ThumbnailLoaded", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3500 { "studyInstanceUid" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3501 "seriesInstanceUid" : UTF8ToString($1) }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3502 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3503 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3504 studyInstanceUid.c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3505 seriesInstanceUid.c_str()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3506 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3507 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3508 virtual void SignalSeriesMetadataLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3509 const std::string& seriesInstanceUid) ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3510 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3511 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3512 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3513 customEvent.initCustomEvent("MetadataLoaded", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3514 { "studyInstanceUid" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3515 "seriesInstanceUid" : UTF8ToString($1) }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3516 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3517 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3518 studyInstanceUid.c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3519 seriesInstanceUid.c_str()); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3520 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3521 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3522 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3523 assert(it->second != NULL); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3524 it->second->ApplyScheduledFocus(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3525 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3526 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3527 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3528 virtual void SignalSeriesDetailsReady(const ViewerViewport& viewport) ORTHANC_OVERRIDE |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3529 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3530 EM_ASM({ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3531 const customEvent = document.createEvent("CustomEvent"); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3532 customEvent.initCustomEvent("SeriesDetailsReady", false, false, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3533 { "canvasId" : UTF8ToString($0) }); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3534 window.dispatchEvent(customEvent); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3535 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3536 viewport.GetCanvasId().c_str() |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3537 ); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3538 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3539 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3540 virtual void SignalFrameUpdated(const ViewerViewport& viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3541 size_t currentFrame, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3542 size_t countFrames, |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3543 DisplayedFrameQuality quality, |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3544 unsigned int instanceNumber, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3545 const std::string& contentDate, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3546 const std::string& contentTime) ORTHANC_OVERRIDE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3547 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3548 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3549 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3550 customEvent.initCustomEvent("FrameUpdated", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3551 { "canvasId" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3552 "currentFrame" : $1, |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
3553 "numberOfFrames" : $2, |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3554 "quality" : $3, |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3555 "instanceNumber" : $4, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3556 "contentDate" : UTF8ToString($5), |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3557 "contentTime" : UTF8ToString($6), |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3558 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3559 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3560 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3561 viewport.GetCanvasId().c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3562 static_cast<int>(currentFrame), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3563 static_cast<int>(countFrames), |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3564 quality, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3565 instanceNumber, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3566 contentDate.c_str(), |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3567 contentTime.c_str()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3568 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3569 UpdateReferenceLines(); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3570 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3571 |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3572 virtual void SignalCrosshair(const ViewerViewport& viewport, |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3573 const OrthancStone::Vector& click) ORTHANC_OVERRIDE |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3574 { |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3575 if (click.size() != 3u) |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3576 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3577 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3578 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3579 |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3580 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3581 { |
1694 | 3582 // TODO - One could check the "Frame Of Reference UID" here |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3583 assert(it->second.get() != NULL); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3584 if (it->second.get() != &viewport) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3585 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3586 it->second->FocusOnPoint(click); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3587 } |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3588 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3589 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3590 |
1694 | 3591 virtual void SignalSynchronizedBrowsing(const ViewerViewport& viewport, |
3592 const OrthancStone::Vector& click, | |
3593 const OrthancStone::Vector& normal) ORTHANC_OVERRIDE | |
3594 { | |
3595 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) | |
3596 { | |
3597 assert(it->second.get() != NULL); | |
3598 | |
3599 OrthancStone::CoordinateSystem3D plane; | |
3600 bool isOpposite; | |
3601 | |
3602 if (it->second.get() != &viewport && | |
3603 it->second->GetCurrentPlane(plane) && | |
3604 OrthancStone::GeometryToolbox::IsParallelOrOpposite(isOpposite, plane.GetNormal(), normal)) | |
3605 { | |
3606 it->second->FocusOnPoint(click); | |
3607 } | |
3608 } | |
3609 } | |
3610 | |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3611 virtual void SignalSeriesPdfLoaded(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3612 const std::string& seriesInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3613 const std::string& pdf) ORTHANC_OVERRIDE |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3614 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3615 EM_ASM({ |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3616 const customEvent = document.createEvent("CustomEvent"); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3617 customEvent.initCustomEvent("PdfLoaded", false, false, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3618 { "studyInstanceUid" : UTF8ToString($0), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3619 "seriesInstanceUid" : UTF8ToString($1), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3620 "pdfPointer" : $2, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3621 "pdfSize": $3}); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3622 window.dispatchEvent(customEvent); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3623 }, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3624 studyInstanceUid.c_str(), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3625 seriesInstanceUid.c_str(), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3626 pdf.empty() ? 0 : reinterpret_cast<intptr_t>(pdf.c_str()), // Explicit conversion to an integer |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3627 pdf.size()); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3628 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3629 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3630 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3631 virtual void SignalVirtualSeriesThumbnailLoaded(const std::string& virtualSeriesId, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3632 const std::string& jpeg) ORTHANC_OVERRIDE |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3633 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3634 std::string dataUriScheme; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3635 Orthanc::Toolbox::EncodeDataUriScheme(dataUriScheme, "image/jpeg", jpeg); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3636 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3637 EM_ASM({ |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3638 const customEvent = document.createEvent("CustomEvent"); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3639 customEvent.initCustomEvent("VirtualSeriesThumbnailLoaded", false, false, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3640 { "virtualSeriesId" : UTF8ToString($0), |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3641 "thumbnail" : UTF8ToString($1) }); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3642 window.dispatchEvent(customEvent); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3643 }, |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3644 virtualSeriesId.c_str(), |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3645 dataUriScheme.c_str()); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3646 } |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3647 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3648 virtual void SignalWindowingUpdated(const ViewerViewport& viewport, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3649 double windowingCenter, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3650 double windowingWidth) ORTHANC_OVERRIDE |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3651 { |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3652 EM_ASM({ |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3653 const customEvent = document.createEvent("CustomEvent"); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3654 customEvent.initCustomEvent("WindowingUpdated", false, false, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3655 { "canvasId" : UTF8ToString($0), |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3656 "windowingCenter" : $1, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3657 "windowingWidth" : $2 }); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3658 window.dispatchEvent(customEvent); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3659 }, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3660 viewport.GetCanvasId().c_str(), |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3661 static_cast<int>(boost::math::iround<double>(windowingCenter)), |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3662 static_cast<int>(boost::math::iround<double>(windowingWidth))); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3663 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3664 UpdateReferenceLines(); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3665 } |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3666 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3667 virtual void SignalStoneAnnotationsChanged(const ViewerViewport& viewport, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3668 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3669 size_t frame) ORTHANC_OVERRIDE |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3670 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3671 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3672 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3673 assert(it->second.get() != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3674 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3675 if (it->second.get() != &viewport) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3676 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3677 it->second->SignalStoneAnnotationsChanged(sopInstanceUid, frame); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3678 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3679 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3680 } |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3681 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3682 virtual void SignalStoneAnnotationAdded(const ViewerViewport& viewport) ORTHANC_OVERRIDE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3683 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3684 EM_ASM({ |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3685 const customEvent = document.createEvent("CustomEvent"); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3686 customEvent.initCustomEvent("StoneAnnotationAdded", false, false, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3687 { "canvasId" : UTF8ToString($0) }); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3688 window.dispatchEvent(customEvent); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3689 }, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3690 viewport.GetCanvasId().c_str()); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3691 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3692 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3693 virtual void SignalStoneAnnotationRemoved(const ViewerViewport& viewport) ORTHANC_OVERRIDE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3694 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3695 EM_ASM({ |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3696 const customEvent = document.createEvent("CustomEvent"); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3697 customEvent.initCustomEvent("StoneAnnotationRemoved", false, false, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3698 { "canvasId" : UTF8ToString($0) }); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3699 window.dispatchEvent(customEvent); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3700 }, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3701 viewport.GetCanvasId().c_str()); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3702 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3703 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3704 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3705 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3706 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3707 static OrthancStone::DicomSource source_; |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
3708 static boost::shared_ptr<FramesCache> framesCache_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3709 static boost::shared_ptr<OrthancStone::WebAssemblyLoadersContext> context_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3710 static std::string stringBuffer_; |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3711 static bool softwareRendering_ = false; |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
3712 static WebViewerAction leftButtonAction_ = WebViewerAction_Windowing; |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3713 static WebViewerAction middleButtonAction_ = WebViewerAction_Pan; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3714 static WebViewerAction rightButtonAction_ = WebViewerAction_Zoom; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3715 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3716 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3717 static void FormatTags(std::string& target, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3718 const Orthanc::DicomMap& tags) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3719 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3720 Orthanc::DicomArray arr(tags); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3721 Json::Value v = Json::objectValue; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3722 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3723 for (size_t i = 0; i < arr.GetSize(); i++) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3724 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3725 const Orthanc::DicomElement& element = arr.GetElement(i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3726 if (!element.GetValue().IsBinary() && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3727 !element.GetValue().IsNull()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3728 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3729 v[element.GetTag().Format()] = element.GetValue().GetContent(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3730 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3731 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3732 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3733 target = v.toStyledString(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3734 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3735 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3736 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3737 static ResourcesLoader& GetResourcesLoader() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3738 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3739 static boost::shared_ptr<ResourcesLoader> resourcesLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3740 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3741 if (!resourcesLoader_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3742 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3743 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_->Lock()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3744 resourcesLoader_ = ResourcesLoader::Create(*lock, source_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3745 resourcesLoader_->AcquireObserver(new WebAssemblyObserver); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3746 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3747 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3748 return *resourcesLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3749 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3750 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3751 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3752 static boost::shared_ptr<ViewerViewport> GetViewport(const std::string& canvas) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3753 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3754 Viewports::iterator found = allViewports_.find(canvas); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3755 if (found == allViewports_.end()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3756 { |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3757 boost::shared_ptr<ViewerViewport> viewport( |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
3758 ViewerViewport::Create(*context_, source_, canvas, framesCache_, softwareRendering_)); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3759 viewport->SetMouseButtonActions(leftButtonAction_, middleButtonAction_, rightButtonAction_); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3760 viewport->AcquireObserver(new WebAssemblyObserver); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3761 viewport->SetOsiriXAnnotations(osiriXAnnotations_); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3762 allViewports_[canvas] = viewport; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3763 return viewport; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3764 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3765 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3766 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3767 return found->second; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3768 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3769 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3770 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3771 |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3772 #include <emscripten/fetch.h> |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3773 #include "deep-learning/WebAssembly/Worker.pb.h" |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3774 |
1952
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3775 enum DeepLearningState |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3776 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3777 DeepLearningState_Waiting, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3778 DeepLearningState_Pending, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3779 DeepLearningState_Running |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3780 }; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3781 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3782 static DeepLearningState deepLearningState_ = DeepLearningState_Waiting; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3783 static worker_handle deepLearningWorker_; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3784 static std::string deepLearningPendingSopInstanceUid_; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3785 static unsigned int deepLearningPendingFrameNumber_; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3786 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3787 // Forward declaration |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3788 static void DeepLearningCallback(char* data, |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3789 int size, |
1952
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3790 void* payload); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3791 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3792 static void SendRequestToWebWorker(const OrthancStone::Messages::Request& request) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3793 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3794 std::string s; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3795 if (request.SerializeToString(&s) && |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3796 !s.empty()) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3797 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3798 emscripten_call_worker(deepLearningWorker_, "Execute", &s[0], s.size(), DeepLearningCallback, NULL); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3799 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3800 else |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3801 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3802 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3803 "Cannot send command to the Web worker"); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3804 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3805 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3806 |
1952
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3807 static void DeepLearningSchedule(const std::string& sopInstanceUid, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3808 unsigned int frameNumber) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3809 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3810 if (deepLearningState_ == DeepLearningState_Waiting) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3811 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3812 LOG(WARNING) << "Starting deep learning on: " << sopInstanceUid << " / " << frameNumber; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3813 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3814 FramesCache::Accessor accessor(*framesCache_, sopInstanceUid, frameNumber); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3815 if (accessor.IsValid() && |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3816 accessor.GetImage().GetFormat() == Orthanc::PixelFormat_Float32) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3817 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3818 const Orthanc::ImageAccessor& image = accessor.GetImage(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3819 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3820 OrthancStone::Messages::Request request; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3821 request.set_type(OrthancStone::Messages::RequestType::LOAD_IMAGE); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3822 request.mutable_load_image()->set_sop_instance_uid(sopInstanceUid); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3823 request.mutable_load_image()->set_frame_number(frameNumber); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3824 request.mutable_load_image()->set_width(image.GetWidth()); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3825 request.mutable_load_image()->set_height(image.GetHeight()); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3826 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3827 const unsigned int height = image.GetHeight(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3828 const unsigned int width = image.GetWidth(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3829 for (unsigned int y = 0; y < height; y++) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3830 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3831 const float* p = reinterpret_cast<const float*>(image.GetConstRow(y)); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3832 for (unsigned int x = 0; x < width; x++, p++) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3833 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3834 request.mutable_load_image()->mutable_values()->Add(*p); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3835 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3836 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3837 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3838 deepLearningState_ = DeepLearningState_Running; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3839 SendRequestToWebWorker(request); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3840 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3841 else |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3842 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3843 LOG(ERROR) << "Cannot access the frame content, maybe a color image?"; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3844 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3845 EM_ASM({ |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3846 const customEvent = document.createEvent("CustomEvent"); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3847 customEvent.initCustomEvent("DeepLearningStep", false, false, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3848 { "progress" : "0" }); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3849 window.dispatchEvent(customEvent); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3850 }); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3851 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3852 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3853 else |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3854 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3855 deepLearningState_ = DeepLearningState_Pending; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3856 deepLearningPendingSopInstanceUid_ = sopInstanceUid; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3857 deepLearningPendingFrameNumber_ = frameNumber; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3858 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3859 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3860 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3861 static void DeepLearningNextStep() |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3862 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3863 switch (deepLearningState_) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3864 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3865 case DeepLearningState_Pending: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3866 deepLearningState_ = DeepLearningState_Waiting; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3867 DeepLearningSchedule(deepLearningPendingSopInstanceUid_, deepLearningPendingFrameNumber_); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3868 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3869 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3870 case DeepLearningState_Running: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3871 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3872 OrthancStone::Messages::Request request; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3873 request.set_type(OrthancStone::Messages::RequestType::EXECUTE_STEP); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3874 SendRequestToWebWorker(request); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3875 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3876 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3877 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3878 default: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3879 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Bad state for deep learning"); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3880 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3881 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3882 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3883 static void DeepLearningCallback(char* data, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3884 int size, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3885 void* payload) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3886 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3887 try |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3888 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3889 OrthancStone::Messages::Response response; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3890 if (response.ParseFromArray(data, size)) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3891 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3892 switch (response.type()) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3893 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3894 case OrthancStone::Messages::ResponseType::INITIALIZED: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3895 DISPATCH_JAVASCRIPT_EVENT("DeepLearningInitialized"); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3896 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3897 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3898 case OrthancStone::Messages::ResponseType::PARSED_MODEL: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3899 LOG(WARNING) << "Number of steps in the model: " << response.parse_model().number_of_steps(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3900 DISPATCH_JAVASCRIPT_EVENT("DeepLearningModelReady"); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3901 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3902 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3903 case OrthancStone::Messages::ResponseType::LOADED_IMAGE: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3904 DeepLearningNextStep(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3905 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3906 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3907 case OrthancStone::Messages::ResponseType::STEP_DONE: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3908 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3909 EM_ASM({ |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3910 const customEvent = document.createEvent("CustomEvent"); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3911 customEvent.initCustomEvent("DeepLearningStep", false, false, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3912 { "progress" : $0 }); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3913 window.dispatchEvent(customEvent); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3914 }, |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3915 response.step().progress() |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3916 ); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3917 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3918 if (response.step().done()) |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3919 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3920 deepLearningState_ = DeepLearningState_Waiting; |
1953
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3921 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3922 const unsigned int height = response.step().mask().height(); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3923 const unsigned int width = response.step().mask().width(); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3924 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3925 LOG(WARNING) << "SUCCESS! Mask: " << width << "x" << height << " for frame " |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3926 << response.step().mask().sop_instance_uid() << " / " |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3927 << response.step().mask().frame_number(); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3928 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3929 Orthanc::Image mask(Orthanc::PixelFormat_Grayscale8, width, height, false); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3930 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3931 size_t pos = 0; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3932 for (unsigned int y = 0; y < height; y++) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3933 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3934 uint8_t* p = reinterpret_cast<uint8_t*>(mask.GetRow(y)); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3935 for (unsigned int x = 0; x < width; x++, p++, pos++) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3936 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3937 *p = response.step().mask().values(pos) ? 255 : 0; |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3938 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3939 } |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3940 |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3941 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3942 { |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3943 assert(it->second != NULL); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3944 it->second->SetDeepLearningMask(response.step().mask().sop_instance_uid(), |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3945 response.step().mask().frame_number(), mask); |
0661115af939
first successful application of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1952
diff
changeset
|
3946 } |
1952
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3947 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3948 else |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3949 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3950 DeepLearningNextStep(); |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3951 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3952 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3953 break; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3954 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3955 |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3956 default: |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3957 LOG(ERROR) << "Unsupported response type from the deep learning worker"; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3958 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3959 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3960 else |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3961 { |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3962 LOG(ERROR) << "Bad response received from the deep learning worker"; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3963 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3964 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3965 EXTERN_CATCH_EXCEPTIONS; |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3966 } |
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
3967 |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3968 static void DeepLearningModelLoaded(emscripten_fetch_t *fetch) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3969 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3970 try |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3971 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3972 LOG(WARNING) << "Deep learning model loaded: " << fetch->numBytes; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3973 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3974 OrthancStone::Messages::Request request; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3975 request.set_type(OrthancStone::Messages::RequestType::PARSE_MODEL); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3976 request.mutable_parse_model()->mutable_content()->assign(fetch->data, fetch->numBytes); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3977 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3978 emscripten_fetch_close(fetch); // Don't use "fetch" below |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3979 SendRequestToWebWorker(request); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3980 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3981 EXTERN_CATCH_EXCEPTIONS; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3982 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3983 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3984 extern "C" |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3985 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3986 int main(int argc, char const *argv[]) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3987 { |
1665
f62f685e0eb2
avoid loading instance metadata on RTSTRUCT to avoid JSON parsing that freezes the browser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1663
diff
changeset
|
3988 printf("Initializing Stone\n"); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3989 Orthanc::InitializeFramework("", true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3990 Orthanc::Logging::EnableInfoLevel(true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3991 //Orthanc::Logging::EnableTraceLevel(true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3992 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3993 context_.reset(new OrthancStone::WebAssemblyLoadersContext(1, 4, 1)); |
1663
fc883105ee11
enable cache of ParsedDicomFile in oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1657
diff
changeset
|
3994 context_->SetDicomCacheSize(128 * 1024 * 1024); // 128MB |
fc883105ee11
enable cache of ParsedDicomFile in oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1657
diff
changeset
|
3995 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
3996 framesCache_.reset(new FramesCache); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3997 osiriXAnnotations_.reset(new OrthancStone::OsiriX::CollectionOfAnnotations); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3998 |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
3999 deepLearningWorker_ = emscripten_create_worker("DeepLearningWorker.js"); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4000 emscripten_call_worker(deepLearningWorker_, "Initialize", NULL, 0, DeepLearningCallback, NULL); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4001 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4002 DISPATCH_JAVASCRIPT_EVENT("StoneInitialized"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4003 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4004 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4005 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4006 EMSCRIPTEN_KEEPALIVE |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4007 void LoadDeepLearningModel(const char* uri) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4008 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4009 try |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4010 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4011 LOG(WARNING) << "Loading deep learning model: " << uri; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4012 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4013 emscripten_fetch_attr_t attr; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4014 emscripten_fetch_attr_init(&attr); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4015 strcpy(attr.requestMethod, "GET"); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4016 attr.attributes = EMSCRIPTEN_FETCH_LOAD_TO_MEMORY; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4017 attr.onsuccess = DeepLearningModelLoaded; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4018 attr.onerror = NULL; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4019 emscripten_fetch(&attr, uri); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4020 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4021 EXTERN_CATCH_EXCEPTIONS; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4022 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4023 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4024 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4025 EMSCRIPTEN_KEEPALIVE |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4026 void ApplyDeepLearningModel(const char* canvas) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4027 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4028 try |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4029 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4030 boost::shared_ptr<ViewerViewport> viewport = GetViewport(canvas); |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4031 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4032 std::string sopInstanceUid; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4033 unsigned int frameNumber; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4034 if (viewport->GetCurrentFrame(sopInstanceUid, frameNumber)) |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4035 { |
1952
a1e0aae9c17f
support interruption of deep learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1951
diff
changeset
|
4036 DeepLearningSchedule(sopInstanceUid, frameNumber); |
1950
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4037 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4038 else |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4039 { |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4040 LOG(WARNING) << "No active frame"; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4041 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4042 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4043 EXTERN_CATCH_EXCEPTIONS; |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4044 } |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4045 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4046 |
6ffd65cfd2ee
new branch: deep-learning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1948
diff
changeset
|
4047 EMSCRIPTEN_KEEPALIVE |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4048 void SetDicomWebRoot(const char* uri, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4049 int useRendered) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4050 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4051 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4052 { |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4053 source_.SetDicomWebSource(uri); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4054 source_.SetDicomWebRendered(useRendered != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4055 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4056 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4057 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4058 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4059 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4060 EMSCRIPTEN_KEEPALIVE |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4061 void SetDicomWebThroughOrthanc(const char* orthancRoot, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4062 const char* serverName, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4063 int hasRendered) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4064 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4065 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4066 { |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
4067 context_->SetLocalOrthanc(orthancRoot); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4068 source_.SetDicomWebThroughOrthancSource(serverName); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4069 source_.SetDicomWebRendered(hasRendered != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4070 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4071 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4072 } |
1761
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4073 |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4074 |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4075 EMSCRIPTEN_KEEPALIVE |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4076 void AddHttpHeader(const char* header, |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4077 const char* value) |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4078 { |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4079 try |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4080 { |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4081 source_.AddHttpHeader(header, value); |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4082 } |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4083 EXTERN_CATCH_EXCEPTIONS; |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
4084 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4085 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4086 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4087 EMSCRIPTEN_KEEPALIVE |
1714
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4088 void SetDicomCacheSize(int sizeMB) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4089 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4090 try |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4091 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4092 if (sizeMB == 0) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4093 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4094 LOG(WARNING) << "The DICOM cache is disabled"; |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4095 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4096 else |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4097 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4098 LOG(INFO) << "The DICOM cache size is set to " << sizeMB << "MB"; |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4099 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4100 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4101 if (sizeMB >= 0) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4102 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4103 context_->SetDicomCacheSize(sizeMB * 1024 * 1024); |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4104 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4105 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4106 EXTERN_CATCH_EXCEPTIONS; |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4107 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4108 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4109 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
4110 EMSCRIPTEN_KEEPALIVE |
1862
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4111 void SetSkipSeriesFromModalities(const char* value) |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4112 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4113 try |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4114 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4115 LOG(WARNING) << "SetSkipSeriesFromModalities " << value; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4116 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4117 Json::Value modalities; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4118 Orthanc::Toolbox::ReadJson(modalities, value); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4119 std::vector<std::string> skipSeriesFromModalities; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4120 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4121 for (Json::Value::ArrayIndex i = 0; i < modalities.size(); i++) |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4122 { |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4123 skipSeriesFromModalities.push_back(modalities[i].asString()); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4124 } |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4125 GetResourcesLoader().SetSkipSeriesFromModalities(skipSeriesFromModalities); |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4126 } |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4127 EXTERN_CATCH_EXCEPTIONS; |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4128 } |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4129 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4130 |
63587fdeec69
added 'SkipSeriesFromModalities' to ignore series from modality types
Alain Mazy <am@osimis.io>
parents:
1859
diff
changeset
|
4131 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4132 void FetchAllStudies() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4133 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4134 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4135 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4136 GetResourcesLoader().FetchAllStudies(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4137 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4138 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4139 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4140 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4141 EMSCRIPTEN_KEEPALIVE |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4142 void FetchPatient(const char* patientId) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4143 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4144 try |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4145 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4146 GetResourcesLoader().FetchPatient(patientId); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4147 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4148 EXTERN_CATCH_EXCEPTIONS; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4149 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4150 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
4151 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4152 void FetchStudy(const char* studyInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4153 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4154 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4155 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4156 GetResourcesLoader().FetchStudy(studyInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4157 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4158 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4159 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4160 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4161 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4162 void FetchSeries(const char* studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4163 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4164 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4165 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4166 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4167 GetResourcesLoader().FetchSeries(studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4168 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4169 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4170 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4171 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4172 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4173 int GetStudiesCount() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4174 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4175 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4176 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4177 return GetResourcesLoader().GetStudiesCount(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4178 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4179 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4180 return 0; // on exception |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4181 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4182 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4183 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4184 int GetSeriesCount() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4185 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4186 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4187 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4188 return GetResourcesLoader().GetSeriesCount(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4189 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4190 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4191 return 0; // on exception |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4192 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4193 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4194 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4195 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4196 const char* GetStringBuffer() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4197 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4198 return stringBuffer_.c_str(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4199 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4200 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4201 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4202 EMSCRIPTEN_KEEPALIVE |
1827
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4203 const char* GetStoneWebViewerVersion() |
1824
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
4204 { |
1827
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4205 return STONE_WEB_VIEWER_VERSION; |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4206 } |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4207 |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4208 |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4209 EMSCRIPTEN_KEEPALIVE |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4210 const char* GetEmscriptenVersion() |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4211 { |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4212 // WARNING - "static" is important, otherwise the string would be |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4213 // freed when returning to JavaScript |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4214 static const std::string EMSCRIPTEN_VERSION = ( |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4215 boost::lexical_cast<std::string>(__EMSCRIPTEN_major__) + "." + |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4216 boost::lexical_cast<std::string>(__EMSCRIPTEN_minor__) + "." + |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4217 boost::lexical_cast<std::string>(__EMSCRIPTEN_tiny__)); |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
4218 return EMSCRIPTEN_VERSION.c_str(); |
1824
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
4219 } |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
4220 |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
4221 |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
4222 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4223 void LoadStudyTags(int i) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4224 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4225 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4226 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4227 if (i < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4228 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4229 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4230 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4231 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4232 Orthanc::DicomMap dicom; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4233 GetResourcesLoader().GetStudy(dicom, i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4234 FormatTags(stringBuffer_, dicom); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4235 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4236 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4237 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4238 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4239 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4240 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4241 void LoadSeriesTags(int i) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4242 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4243 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4244 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4245 if (i < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4246 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4247 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4248 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4249 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4250 Orthanc::DicomMap dicom; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4251 GetResourcesLoader().GetSeries(dicom, i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4252 FormatTags(stringBuffer_, dicom); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4253 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4254 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4255 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4256 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4257 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4258 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4259 int LoadSeriesThumbnail(const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4260 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4261 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4262 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4263 std::string image, mime; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4264 switch (GetResourcesLoader().GetSeriesThumbnail(image, mime, seriesInstanceUid)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4265 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4266 case OrthancStone::SeriesThumbnailType_Image: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4267 Orthanc::Toolbox::EncodeDataUriScheme(stringBuffer_, mime, image); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4268 return ThumbnailType_Image; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4269 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4270 case OrthancStone::SeriesThumbnailType_Pdf: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4271 return ThumbnailType_Pdf; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4272 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4273 case OrthancStone::SeriesThumbnailType_Video: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4274 return ThumbnailType_Video; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4275 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4276 case OrthancStone::SeriesThumbnailType_NotLoaded: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4277 return ThumbnailType_Loading; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4278 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4279 case OrthancStone::SeriesThumbnailType_Unsupported: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4280 return ThumbnailType_NoPreview; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4281 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4282 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4283 return ThumbnailType_Unknown; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4284 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4285 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4286 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4287 return ThumbnailType_Unknown; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4288 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4289 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4290 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4291 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4292 void SpeedUpFetchSeriesMetadata(const char* studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4293 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4294 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4295 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4296 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4297 GetResourcesLoader().FetchSeriesMetadata(PRIORITY_HIGH, studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4298 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4299 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4300 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4301 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4302 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4303 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4304 int IsSeriesComplete(const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4305 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4306 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4307 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4308 return GetResourcesLoader().IsSeriesComplete(seriesInstanceUid) ? 1 : 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4309 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4310 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4311 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4312 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4313 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4314 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4315 int LoadSeriesInViewport(const char* canvas, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4316 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4317 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4318 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4319 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4320 std::unique_ptr<OrthancStone::SortedFrames> frames(new OrthancStone::SortedFrames); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4321 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4322 if (GetResourcesLoader().SortSeriesFrames(*frames, seriesInstanceUid)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4323 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4324 GetViewport(canvas)->SetFrames(frames.release()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4325 return 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4326 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4327 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4328 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4329 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4330 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4331 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4332 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4333 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4334 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4335 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4336 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4337 EMSCRIPTEN_KEEPALIVE |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4338 int LoadVirtualSeriesInViewport(const char* canvas, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4339 const char* virtualSeriesId) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4340 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4341 try |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4342 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4343 std::unique_ptr<OrthancStone::SortedFrames> frames(new OrthancStone::SortedFrames); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4344 |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4345 if (GetResourcesLoader().SortVirtualSeriesFrames(*frames, virtualSeriesId)) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4346 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4347 GetViewport(canvas)->SetFrames(frames.release()); |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4348 return 1; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4349 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4350 else |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4351 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4352 return 0; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4353 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4354 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4355 EXTERN_CATCH_EXCEPTIONS; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4356 return 0; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4357 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4358 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4359 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
4360 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4361 void AllViewportsUpdateSize(int fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4362 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4363 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4364 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4365 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4366 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4367 assert(it->second != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4368 it->second->UpdateSize(fitContent != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4369 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4370 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4371 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4372 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4373 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4374 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4375 EMSCRIPTEN_KEEPALIVE |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4376 int DecrementFrame(const char* canvas, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4377 int isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4378 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4379 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4380 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4381 return GetViewport(canvas)->ChangeFrame(SeriesCursor::Action_Minus, isCircular) ? 1 : 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4382 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4383 EXTERN_CATCH_EXCEPTIONS; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4384 return 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4385 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4386 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4387 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4388 EMSCRIPTEN_KEEPALIVE |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4389 int IncrementFrame(const char* canvas, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4390 int isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4391 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4392 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4393 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4394 return GetViewport(canvas)->ChangeFrame(SeriesCursor::Action_Plus, isCircular) ? 1 : 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4395 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4396 EXTERN_CATCH_EXCEPTIONS; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4397 return 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4398 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4399 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4400 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4401 EMSCRIPTEN_KEEPALIVE |
1948
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4402 void SetFrame(const char* canvas, |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4403 int frameNumber) |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4404 { |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4405 try |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4406 { |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4407 if (frameNumber >= 0) |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4408 { |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4409 GetViewport(canvas)->SetFrame(static_cast<unsigned int>(frameNumber)); |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4410 } |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4411 } |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4412 EXTERN_CATCH_EXCEPTIONS; |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4413 } |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4414 |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4415 |
d459477804bf
added SetFrame() in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1925
diff
changeset
|
4416 EMSCRIPTEN_KEEPALIVE |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4417 void GoToFirstFrame(const char* canvas) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4418 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4419 try |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4420 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4421 GetViewport(canvas)->GoToFirstFrame(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4422 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4423 EXTERN_CATCH_EXCEPTIONS; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4424 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4425 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4426 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4427 EMSCRIPTEN_KEEPALIVE |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4428 void GoToLastFrame(const char* canvas) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4429 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4430 try |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4431 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4432 GetViewport(canvas)->GoToLastFrame(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4433 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4434 EXTERN_CATCH_EXCEPTIONS; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4435 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4436 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4437 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
4438 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4439 void ShowReferenceLines(int show) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4440 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4441 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4442 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4443 showReferenceLines_ = (show != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4444 UpdateReferenceLines(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4445 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4446 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4447 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4448 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4449 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4450 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4451 void SetWindowing(const char* canvas, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4452 int center, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4453 int width) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4454 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4455 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4456 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4457 GetViewport(canvas)->SetWindowing(center, width); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4458 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4459 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4460 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4461 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4462 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4463 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4464 void InvertContrast(const char* canvas) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4465 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4466 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4467 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4468 GetViewport(canvas)->Invert(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4469 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4470 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4471 } |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4472 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4473 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4474 EMSCRIPTEN_KEEPALIVE |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4475 void FlipX(const char* canvas) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4476 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4477 try |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4478 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4479 GetViewport(canvas)->FlipX(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4480 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4481 EXTERN_CATCH_EXCEPTIONS; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4482 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4483 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4484 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4485 EMSCRIPTEN_KEEPALIVE |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4486 void FlipY(const char* canvas) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4487 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4488 try |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4489 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4490 GetViewport(canvas)->FlipY(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4491 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4492 EXTERN_CATCH_EXCEPTIONS; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4493 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4494 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4495 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
4496 EMSCRIPTEN_KEEPALIVE |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4497 void SetSoftwareRendering(int softwareRendering) |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4498 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4499 softwareRendering_ = softwareRendering; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4500 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4501 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4502 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4503 EMSCRIPTEN_KEEPALIVE |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4504 int IsSoftwareRendering() |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4505 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4506 return softwareRendering_; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
4507 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4508 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4509 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4510 EMSCRIPTEN_KEEPALIVE |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4511 void SetMouseButtonActions(int leftAction, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4512 int middleAction, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4513 int rightAction) |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4514 { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4515 try |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4516 { |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
4517 leftButtonAction_ = static_cast<WebViewerAction>(leftAction); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
4518 middleButtonAction_ = static_cast<WebViewerAction>(middleAction); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
4519 rightButtonAction_ = static_cast<WebViewerAction>(rightAction); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4520 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4521 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4522 { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4523 assert(it->second != NULL); |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4524 it->second->SetMouseButtonActions(leftButtonAction_, middleButtonAction_, rightButtonAction_); |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4525 } |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4526 } |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4527 EXTERN_CATCH_EXCEPTIONS; |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
4528 } |
1575 | 4529 |
4530 | |
4531 EMSCRIPTEN_KEEPALIVE | |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4532 int GetLeftMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4533 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4534 return static_cast<int>(leftButtonAction_); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4535 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4536 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4537 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4538 EMSCRIPTEN_KEEPALIVE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4539 int GetMiddleMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4540 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4541 return static_cast<int>(middleButtonAction_); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4542 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4543 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4544 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4545 EMSCRIPTEN_KEEPALIVE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4546 int GetRightMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4547 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4548 return static_cast<int>(rightButtonAction_); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4549 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4550 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4551 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
4552 EMSCRIPTEN_KEEPALIVE |
1578 | 4553 void FitForPrint() |
1575 | 4554 { |
4555 try | |
4556 { | |
4557 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) | |
4558 { | |
4559 assert(it->second != NULL); | |
4560 it->second->FitForPrint(); | |
4561 } | |
4562 } | |
4563 EXTERN_CATCH_EXCEPTIONS; | |
4564 } | |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4565 |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4566 |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4567 // Side-effect: "GetStringBuffer()" is filled with the "Series |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4568 // Instance UID" of the first loaded annotation |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4569 EMSCRIPTEN_KEEPALIVE |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4570 int LoadOsiriXAnnotations(const char* xml, |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4571 int clearPreviousAnnotations) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4572 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4573 try |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4574 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4575 if (clearPreviousAnnotations) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4576 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4577 osiriXAnnotations_->Clear(); |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4578 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4579 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4580 osiriXAnnotations_->LoadXml(xml); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4581 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4582 // Force redraw, as the annotations might have changed |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4583 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4584 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4585 assert(it->second != NULL); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4586 it->second->Redraw(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4587 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4588 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4589 if (osiriXAnnotations_->GetSize() == 0) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4590 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4591 stringBuffer_.clear(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4592 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4593 else |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4594 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4595 stringBuffer_ = osiriXAnnotations_->GetAnnotation(0).GetSeriesInstanceUid(); |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4596 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4597 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4598 LOG(WARNING) << "Loaded " << osiriXAnnotations_->GetSize() << " annotations from OsiriX"; |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4599 return 1; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4600 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4601 EXTERN_CATCH_EXCEPTIONS; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4602 return 0; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4603 } |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4604 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4605 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4606 EMSCRIPTEN_KEEPALIVE |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4607 void FocusFirstOsiriXAnnotation(const char* canvas) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4608 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4609 try |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4610 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4611 if (osiriXAnnotations_->GetSize() != 0) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4612 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4613 const OrthancStone::OsiriX::Annotation& annotation = osiriXAnnotations_->GetAnnotation(0); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4614 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4615 boost::shared_ptr<ViewerViewport> viewport = GetViewport(canvas); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4616 viewport->ScheduleFrameFocus(annotation.GetSopInstanceUid(), 0 /* focus on first frame */); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4617 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4618 // Force redraw, as the annotations might already have changed |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4619 viewport->Redraw(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4620 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4621 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4622 EXTERN_CATCH_EXCEPTIONS; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4623 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4624 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4625 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4626 EMSCRIPTEN_KEEPALIVE |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4627 void FetchPdf(const char* studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4628 const char* seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4629 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4630 try |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4631 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4632 LOG(INFO) << "Fetching PDF series: " << seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4633 GetResourcesLoader().FetchPdf(studyInstanceUid, seriesInstanceUid); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4634 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4635 EXTERN_CATCH_EXCEPTIONS; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4636 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4637 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4638 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4639 EMSCRIPTEN_KEEPALIVE |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4640 unsigned int GetCineRate(const char* canvas) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4641 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4642 try |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4643 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4644 return GetViewport(canvas)->GetCineRate(); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4645 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4646 EXTERN_CATCH_EXCEPTIONS; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4647 return 0; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4648 } |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4649 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4650 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4651 EMSCRIPTEN_KEEPALIVE |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4652 unsigned int GetSeriesNumberOfFrames(const char* seriesInstanceUid) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4653 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4654 try |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4655 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4656 return GetResourcesLoader().GetSeriesNumberOfFrames(seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4657 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4658 EXTERN_CATCH_EXCEPTIONS; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4659 return 0; |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4660 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4661 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4662 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4663 EMSCRIPTEN_KEEPALIVE |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4664 void LoadWindowingPresets(const char* canvas) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4665 { |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4666 try |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4667 { |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4668 Json::Value v; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4669 GetViewport(canvas)->FormatWindowingPresets(v); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4670 stringBuffer_ = v.toStyledString(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4671 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4672 EXTERN_CATCH_EXCEPTIONS; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4673 } |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4674 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4675 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4676 EMSCRIPTEN_KEEPALIVE |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4677 void SetSynchronizedBrowsingEnabled(int enabled) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4678 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4679 try |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4680 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4681 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4682 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4683 assert(it->second != NULL); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4684 it->second->SetSynchronizedBrowsingEnabled(enabled); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4685 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4686 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4687 EXTERN_CATCH_EXCEPTIONS; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4688 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4689 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4690 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4691 EMSCRIPTEN_KEEPALIVE |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4692 int LookupVirtualSeries(const char* seriesInstanceUid) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4693 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4694 try |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4695 { |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4696 typedef std::map<std::string, unsigned int> VirtualSeries; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4697 |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4698 VirtualSeries virtualSeries; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4699 if (GetResourcesLoader().LookupVirtualSeries(virtualSeries, seriesInstanceUid)) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4700 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4701 Json::Value json = Json::arrayValue; |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4702 for (VirtualSeries::const_iterator it = virtualSeries.begin(); it != virtualSeries.end(); ++it) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4703 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4704 Json::Value item = Json::objectValue; |
1850
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4705 item["ID"] = it->first; |
932dc2265baa
Group together in a single "virtual series" all the instances without the tag "NumberOfFrames"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1849
diff
changeset
|
4706 item["NumberOfFrames"] = it->second; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4707 json.append(item); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4708 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4709 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4710 stringBuffer_ = json.toStyledString(); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4711 return true; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4712 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4713 else |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4714 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4715 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4716 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4717 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4718 EXTERN_CATCH_EXCEPTIONS; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4719 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4720 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4721 } |