Mercurial > hg > orthanc-stone
annotate Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1859:58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 20 Sep 2021 17:08:23 +0200 |
parents | 73a4bee08bb6 |
children | 63587fdeec69 |
rev | line source |
---|---|
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1722
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1593
diff
changeset
|
16 * |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
22 #include <EmbeddedResources.h> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include <emscripten.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
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 #define DISPATCH_JAVASCRIPT_EVENT(name) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 EM_ASM( \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 const customEvent = document.createEvent("CustomEvent"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 customEvent.initCustomEvent(name, false, false, undefined); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 window.dispatchEvent(customEvent); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 ); |
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 #define EXTERN_CATCH_EXCEPTIONS \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 catch (Orthanc::OrthancException& e) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 LOG(ERROR) << "OrthancException: " << e.What(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 } \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 catch (OrthancStone::StoneException& e) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 LOG(ERROR) << "StoneException: " << e.What(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 } \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 catch (std::exception& e) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 LOG(ERROR) << "Runtime error: " << e.what(); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 } \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 catch (...) \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 { \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 LOG(ERROR) << "Native exception"; \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 DISPATCH_JAVASCRIPT_EVENT("StoneException"); \ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 } |
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 |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
57 // Orthanc framework includes |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 #include <Cache/MemoryObjectCache.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 #include <DicomFormat/DicomArray.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
60 #include <DicomParsing/ParsedDicomFile.h> |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 #include <Images/Image.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 #include <Images/ImageProcessing.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 #include <Images/JpegReader.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 #include <Logging.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
66 // Stone includes |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
67 #include <Loaders/DicomResourcesLoader.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
68 #include <Loaders/SeriesMetadataLoader.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
69 #include <Loaders/SeriesThumbnailsLoader.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
70 #include <Messages/ObserverBase.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
71 #include <Oracle/ParseDicomFromWadoCommand.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
72 #include <Oracle/ParseDicomSuccessMessage.h> |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
73 #include <Scene2D/AnnotationsSceneLayer.h> |
1614
ad9b425f27ae
new class: ArrowSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1611
diff
changeset
|
74 #include <Scene2D/ArrowSceneLayer.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
75 #include <Scene2D/ColorTextureSceneLayer.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
76 #include <Scene2D/FloatTextureSceneLayer.h> |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1607
diff
changeset
|
77 #include <Scene2D/MacroSceneLayer.h> |
1615
f5d4bd7b5593
new class: OsiriXLayerFactory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1614
diff
changeset
|
78 #include <Scene2D/OsiriXLayerFactory.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
79 #include <Scene2D/PolylineSceneLayer.h> |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
80 #include <Scene2D/TextSceneLayer.h> |
1558 | 81 #include <Scene2DViewport/ViewportController.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
82 #include <StoneException.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
83 #include <Toolbox/DicomInstanceParameters.h> |
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
84 #include <Toolbox/GeometryToolbox.h> |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
85 #include <Toolbox/OsiriX/AngleAnnotation.h> |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
86 #include <Toolbox/OsiriX/CollectionOfAnnotations.h> |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
87 #include <Toolbox/OsiriX/LineAnnotation.h> |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
88 #include <Toolbox/OsiriX/TextAnnotation.h> |
1549
a48ae10857b1
packaging of the WebAssembly module
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1544
diff
changeset
|
89 #include <Toolbox/SortedFrames.h> |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
90 #include <Viewport/DefaultViewportInteractor.h> |
1591
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
91 |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
92 // WebAssembly includes |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
93 #include <WebAssemblyCairoViewport.h> |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
94 #include <WebAssemblyLoadersContext.h> |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
95 #include <WebGLViewport.h> |
5887a4f8594b
moving platform-specific files out of the "OrthancStone" folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1580
diff
changeset
|
96 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
98 #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
|
99 #include <boost/make_shared.hpp> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 #include <stdio.h> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
103 #if !defined(STONE_WEB_VIEWER_EXPORT) |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
104 // 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
|
105 # define STONE_WEB_VIEWER_EXPORT |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
106 #endif |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
107 |
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
108 |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
109 #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
|
110 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
111 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
112 enum STONE_WEB_VIEWER_EXPORT ThumbnailType |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 ThumbnailType_Image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 ThumbnailType_NoPreview, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 ThumbnailType_Pdf, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 ThumbnailType_Video, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 ThumbnailType_Loading, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 ThumbnailType_Unknown |
1668 | 120 }; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
123 enum STONE_WEB_VIEWER_EXPORT DisplayedFrameQuality |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
125 DisplayedFrameQuality_None, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
126 DisplayedFrameQuality_Low, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
127 DisplayedFrameQuality_High |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
128 }; |
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 |
1632
9a4c09361f3e
removed annoying warning
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1630
diff
changeset
|
131 enum STONE_WEB_VIEWER_EXPORT WebViewerAction |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
132 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
133 WebViewerAction_None, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
134 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
135 WebViewerAction_Windowing, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
136 WebViewerAction_Zoom, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
137 WebViewerAction_Pan, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
138 WebViewerAction_Rotate, |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
139 WebViewerAction_Crosshair, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
140 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
141 WebViewerAction_CreateAngle, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
142 WebViewerAction_CreateCircle, |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
143 WebViewerAction_CreateSegment, |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
144 WebViewerAction_RemoveMeasure |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
145 }; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
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 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
149 static OrthancStone::MouseAction ConvertWebViewerAction(int action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
150 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
151 switch (action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
152 { |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
153 case WebViewerAction_Windowing: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
154 return OrthancStone::MouseAction_GrayscaleWindowing; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
155 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
156 case WebViewerAction_Zoom: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
157 return OrthancStone::MouseAction_Zoom; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
158 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
159 case WebViewerAction_Pan: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
160 return OrthancStone::MouseAction_Pan; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
161 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
162 case WebViewerAction_Rotate: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
163 return OrthancStone::MouseAction_Rotate; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
164 |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
165 case WebViewerAction_None: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
166 case WebViewerAction_Crosshair: |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
167 case WebViewerAction_CreateAngle: |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
168 case WebViewerAction_CreateCircle: |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
169 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
|
170 case WebViewerAction_RemoveMeasure: |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
171 return OrthancStone::MouseAction_None; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
172 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
173 default: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
174 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
175 } |
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 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 static const int PRIORITY_HIGH = -100; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 static const int PRIORITY_LOW = 100; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 static const int PRIORITY_NORMAL = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 static const unsigned int QUALITY_JPEG = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 static const unsigned int QUALITY_FULL = 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
187 static const unsigned int DEFAULT_CINE_RATE = 30; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
188 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
189 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
190 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
191 class VirtualSeries : public boost::noncopyable |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
192 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
193 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
|
194 class Item : public boost::noncopyable |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
195 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
196 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
|
197 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
|
198 std::list<std::string> sopInstanceUids_; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
199 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
200 public: |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
201 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
|
202 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
|
203 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
|
204 sopInstanceUids_(sopInstanceUids) |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
205 { |
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 const std::string& GetSeriesInstanceUid() const |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
209 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
210 return seriesInstanceUid_; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
211 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
212 |
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
|
213 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
|
214 { |
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
|
215 return sopInstanceUids_; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
216 } |
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 |
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
|
219 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
|
220 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
221 Content content_; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
222 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
223 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
|
224 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
225 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
|
226 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
227 if (found == content_.end()) |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
228 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
229 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
230 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
231 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
232 { |
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
|
233 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
|
234 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
|
235 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
236 } |
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 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
|
239 ~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
|
240 { |
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 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
|
242 { |
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 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
|
244 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
|
245 } |
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 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
|
249 const std::string& sopInstanceUid) |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
250 { |
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
|
251 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
|
252 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
|
253 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
|
254 } |
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 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
|
257 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
|
258 { |
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 // 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
|
260 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
|
261 |
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 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
|
263 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
264 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
265 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
266 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
267 { |
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
|
268 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
|
269 return virtualSeriesId; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
270 } |
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 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
|
274 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
275 return GetItem(id).GetSeriesInstanceUid(); |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
276 } |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
277 |
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
|
278 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
|
279 { |
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
|
280 return GetItem(id).GetSopInstanceUids(); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
281 } |
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 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 class ResourcesLoader : public OrthancStone::ObserverBase<ResourcesLoader> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 class IObserver : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 virtual ~IObserver() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 { |
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 virtual void SignalResourcesLoaded() = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 virtual void SignalSeriesThumbnailLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 const std::string& seriesInstanceUid) = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 virtual void SignalSeriesMetadataLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 const std::string& seriesInstanceUid) = 0; |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
303 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
304 virtual void SignalSeriesPdfLoaded(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
305 const std::string& seriesInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
306 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
|
307 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
308 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
|
309 const std::string& jpeg) = 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 }; |
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 private: |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
313 OrthancStone::ILoadersContext& context_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 std::unique_ptr<IObserver> observer_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 OrthancStone::DicomSource source_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 size_t pending_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 boost::shared_ptr<OrthancStone::LoadedDicomResources> studies_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 boost::shared_ptr<OrthancStone::LoadedDicomResources> series_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 boost::shared_ptr<OrthancStone::DicomResourcesLoader> resourcesLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 boost::shared_ptr<OrthancStone::SeriesThumbnailsLoader> thumbnailsLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 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
|
322 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
|
323 VirtualSeries virtualSeries_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
325 explicit ResourcesLoader(OrthancStone::ILoadersContext& context, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
326 const OrthancStone::DicomSource& source) : |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
327 context_(context), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 source_(source), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 pending_(0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 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
|
331 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
|
332 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) |
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 const Orthanc::SingleValueObject<Orthanc::ResourceType>& payload = |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 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
|
339 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 OrthancStone::LoadedDicomResources& dicom = *message.GetResources(); |
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 LOG(INFO) << "resources loaded: " << dicom.GetSize() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 << ", " << Orthanc::EnumerationToString(payload.GetValue()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 if (payload.GetValue() == Orthanc::ResourceType_Series) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 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
|
348 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 std::string studyInstanceUid, seriesInstanceUid; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 if (dicom.GetResource(i).LookupStringValue( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 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
|
352 dicom.GetResource(i).LookupStringValue( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 seriesInstanceUid, Orthanc::DICOM_TAG_SERIES_INSTANCE_UID, false)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 thumbnailsLoader_->ScheduleLoadThumbnail(source_, "", studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 metadataLoader_->ScheduleLoadSeries(PRIORITY_LOW + 1, source_, studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 if (pending_ == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 pending_ --; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 if (pending_ == 0 && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 observer_->SignalResourcesLoaded(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 void Handle(const OrthancStone::SeriesThumbnailsLoader::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 observer_->SignalSeriesThumbnailLoaded( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 message.GetStudyInstanceUid(), message.GetSeriesInstanceUid()); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 void Handle(const OrthancStone::SeriesMetadataLoader::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 observer_->SignalSeriesMetadataLoaded( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 message.GetStudyInstanceUid(), message.GetSeriesInstanceUid()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
394 void FetchInternal(const std::string& patientId, |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
395 const std::string& studyInstanceUid, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
396 const std::string& seriesInstanceUid) |
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 // Firstly, load the study |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
399 Orthanc::DicomMap filter; |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
400 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
401 if (!patientId.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
402 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
403 filter.SetValue(Orthanc::DICOM_TAG_PATIENT_ID, patientId, false); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
404 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
405 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
406 if (!studyInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
407 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
408 filter.SetValue(Orthanc::DICOM_TAG_STUDY_INSTANCE_UID, studyInstanceUid, false); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
409 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
410 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
411 std::set<Orthanc::DicomTag> tags; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 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
|
413 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 resourcesLoader_->ScheduleQido( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
415 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
|
416 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
|
417 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
418 // Secondly, load the series |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 if (!seriesInstanceUid.empty()) |
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 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
|
422 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 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
|
425 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 resourcesLoader_->ScheduleQido( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
427 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
|
428 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
|
429 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
430 pending_ += 2; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 } |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
432 |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
433 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
434 class PdfInfo : public Orthanc::IDynamicObject |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
435 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
436 private: |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
437 std::string studyInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
438 std::string seriesInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
439 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
440 public: |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
441 PdfInfo(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
442 const std::string& seriesInstanceUid) : |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
443 studyInstanceUid_(studyInstanceUid), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
444 seriesInstanceUid_(seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
445 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
446 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
447 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
448 const std::string& GetStudyInstanceUid() const |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
449 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
450 return studyInstanceUid_; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
451 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
452 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
453 const std::string& GetSeriesInstanceUid() const |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
454 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
455 return seriesInstanceUid_; |
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 }; |
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 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
460 void Handle(const OrthancStone::ParseDicomSuccessMessage& message) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
461 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
462 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
|
463 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
464 if (observer_.get() != NULL) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
465 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
466 std::string pdf; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
467 if (message.GetDicom().ExtractPdf(pdf)) |
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 observer_->SignalSeriesPdfLoaded(info.GetStudyInstanceUid(), info.GetSeriesInstanceUid(), pdf); |
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 else |
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 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
|
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 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
477 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
478 void FetchVirtualSeriesThumbnail(const std::string& virtualSeriesId, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
479 const std::string& studyInstanceUid, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
480 const std::string& seriesInstanceUid, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
481 const std::string& sopInstanceUid) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
482 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
483 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
|
484 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
485 scheduledVirtualSeriesThumbnails_.insert(virtualSeriesId); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
486 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
487 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
|
488 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
|
489 arguments["viewport"] = ( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
490 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
|
491 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
|
492 headers["Accept"] = Orthanc::MIME_JPEG; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
493 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
494 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
|
495 "/instances/" + sopInstanceUid + "/frames/1/rendered"); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
496 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
497 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
498 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
|
499 lock->Schedule( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
500 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
|
501 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
|
502 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
503 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
504 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
505 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
506 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
|
507 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
508 if (observer_.get() != NULL) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
509 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
510 const std::string& virtualSeriesId = |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
511 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
|
512 message.GetOrigin().GetPayload()).GetValue(); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
513 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
|
514 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
515 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
516 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 static boost::shared_ptr<ResourcesLoader> Create(OrthancStone::ILoadersContext::ILock& lock, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
519 const OrthancStone::DicomSource& source) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
520 { |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
521 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
|
522 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
523 loader->resourcesLoader_ = OrthancStone::DicomResourcesLoader::Create(lock); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
524 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
|
525 loader->metadataLoader_ = OrthancStone::SeriesMetadataLoader::Create(lock); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
526 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
527 loader->Register<OrthancStone::DicomResourcesLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 *loader->resourcesLoader_, &ResourcesLoader::Handle); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
529 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 loader->Register<OrthancStone::SeriesThumbnailsLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 *loader->thumbnailsLoader_, &ResourcesLoader::Handle); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 loader->Register<OrthancStone::SeriesMetadataLoader::SuccessMessage>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 *loader->metadataLoader_, &ResourcesLoader::Handle); |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
535 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
536 loader->Register<OrthancStone::ParseDicomSuccessMessage>( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
537 lock.GetOracleObservable(), &ResourcesLoader::Handle); |
1703
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 loader->Register<OrthancStone::HttpCommand::SuccessMessage>( |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
540 lock.GetOracleObservable(), &ResourcesLoader::HandleInstanceThumbnail); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
541 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 return loader; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 void FetchAllStudies() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
547 FetchInternal("", "", ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
548 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
549 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
550 void FetchPatient(const std::string& patientId) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
551 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
552 if (!patientId.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
553 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
554 FetchInternal(patientId, "", ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
555 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
556 } |
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 void FetchStudy(const std::string& studyInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
559 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
560 if (!studyInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
561 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
562 FetchInternal("", studyInstanceUid, ""); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
563 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
564 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
565 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
566 void FetchSeries(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
567 const std::string& seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
568 { |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
569 if (!studyInstanceUid.empty() && |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
570 !seriesInstanceUid.empty()) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
571 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
572 FetchInternal("", studyInstanceUid, seriesInstanceUid); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
573 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
574 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
575 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
576 size_t GetStudiesCount() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
577 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
578 return studies_->GetSize(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
579 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
580 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
581 size_t GetSeriesCount() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
582 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
583 return series_->GetSize(); |
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 GetStudy(Orthanc::DicomMap& target, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
587 size_t i) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
588 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
589 target.Assign(studies_->GetResource(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
590 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
591 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
592 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
|
593 size_t i) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
595 target.Assign(series_->GetResource(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
596 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
597 // Complement with the study-level tags |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
598 std::string studyInstanceUid; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
599 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
|
600 studies_->HasResource(studyInstanceUid)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
601 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
602 studies_->MergeResource(target, studyInstanceUid); |
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 } |
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 OrthancStone::SeriesThumbnailType GetSeriesThumbnail(std::string& image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
607 std::string& mime, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
608 const std::string& seriesInstanceUid) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
609 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
610 return thumbnailsLoader_->GetSeriesThumbnail(image, mime, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
611 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
612 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
613 void FetchSeriesMetadata(int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
614 const std::string& studyInstanceUid, |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
615 const std::string& seriesInstanceUid) 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 metadataLoader_->ScheduleLoadSeries(priority, source_, studyInstanceUid, seriesInstanceUid); |
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 |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
620 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
|
621 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
622 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
623 return accessor.IsComplete(); |
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 |
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
|
626 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
|
627 const std::string& seriesInstanceUid) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
628 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
629 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
|
630 if (accessor.IsComplete() && |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
631 accessor.GetInstancesCount() >= 2) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
632 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
633 bool hasMultiframe = false; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
634 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
635 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
|
636 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
637 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
|
638 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
639 if (p.GetNumberOfFrames() > 1) |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
640 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
641 hasMultiframe = true; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
642 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
643 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
644 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
645 if (hasMultiframe) |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
646 { |
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
|
647 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
|
648 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
|
649 |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
650 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
|
651 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
652 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
|
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 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
|
655 { |
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
|
656 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
|
657 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
|
658 { |
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
|
659 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
|
660 } |
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
|
661 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
|
662 { |
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
|
663 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
|
664 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
|
665 } |
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
|
666 } |
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
|
667 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
|
668 { |
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
|
669 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
|
670 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
|
671 } |
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
|
672 } |
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
|
673 |
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
|
674 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
|
675 { |
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 /** |
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 * 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
|
678 * 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
|
679 * (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
|
680 * 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
|
681 * 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
|
682 **/ |
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 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
|
684 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
|
685 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
|
686 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
687 |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
688 return true; |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
689 } |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
690 else |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
691 { |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
692 return false; |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
693 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
694 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
695 else |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
696 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
697 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
698 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
699 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
700 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
701 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
|
702 const std::string& seriesInstanceUid) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
703 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
704 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
705 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
706 if (accessor.IsComplete()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
707 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
708 target.Clear(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
709 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
710 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
|
711 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
712 target.AddInstance(accessor.GetInstance(i)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
713 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
714 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
715 target.Sort(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
716 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
717 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
718 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
719 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
720 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
721 return false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
722 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
723 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
724 |
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
|
725 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
|
726 const std::string& virtualSeriesId) const |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
727 { |
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
|
728 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
|
729 |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
730 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
731 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
732 if (accessor.IsComplete()) |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
733 { |
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
|
734 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
|
735 |
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
|
736 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
|
737 |
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
|
738 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
|
739 it = sopInstanceUids.begin(); it != sopInstanceUids.end(); ++it) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
740 { |
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
|
741 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
|
742 if (accessor.LookupInstance(instance, *it)) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
743 { |
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
|
744 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
|
745 } |
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
|
746 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
|
747 { |
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
|
748 LOG(ERROR) << "Missing instance: " << *it; |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
749 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
750 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
751 |
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
|
752 target.Sort(); |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
753 return true; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
754 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
755 else |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
756 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
757 return false; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
758 } |
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 |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
761 size_t GetSeriesNumberOfFrames(const std::string& seriesInstanceUid) const |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
762 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
763 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
764 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
765 if (accessor.IsComplete()) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
766 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
767 size_t count = 0; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
768 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
769 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
|
770 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
771 uint32_t f; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
772 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
|
773 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
774 count += f; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
775 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
776 else |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
777 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
778 count++; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
779 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
780 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
781 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
782 return count; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
783 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
784 else |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
785 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
786 return 0; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
787 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
788 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
789 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
790 void AcquireObserver(IObserver* observer) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
791 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
792 observer_.reset(observer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
793 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
794 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
795 void FetchPdf(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
796 const std::string& seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
797 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
798 OrthancStone::SeriesMetadataLoader::Accessor accessor(*metadataLoader_, seriesInstanceUid); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
799 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
800 if (accessor.IsComplete()) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
801 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
802 if (accessor.GetInstancesCount() > 1) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
803 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
804 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
|
805 << seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
806 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
807 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
808 for (size_t i = 0; i < accessor.GetInstancesCount(); i++) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
809 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
810 std::string sopClassUid, sopInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
811 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
|
812 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
|
813 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
|
814 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
815 std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(context_.Lock()); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
816 lock->Schedule( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
817 GetSharedObserver(), PRIORITY_NORMAL, OrthancStone::ParseDicomFromWadoCommand::Create( |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
818 source_, studyInstanceUid, seriesInstanceUid, sopInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
819 false /* no transcoding */, Orthanc::DicomTransferSyntax_LittleEndianExplicit /* dummy value */, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
820 new PdfInfo(studyInstanceUid, seriesInstanceUid))); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
821 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
822 return; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
823 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
824 } |
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 LOG(WARNING) << "Series without a PDF: " << 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 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
829 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
830 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
831 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
832 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
833 class FramesCache : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
834 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
835 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
836 class CachedImage : public Orthanc::ICacheable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
837 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
838 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
839 std::unique_ptr<Orthanc::ImageAccessor> image_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
840 unsigned int quality_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
841 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
842 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
843 CachedImage(Orthanc::ImageAccessor* image, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
844 unsigned int quality) : |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
845 image_(image), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
846 quality_(quality) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
847 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
848 assert(image != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
849 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
850 |
1573 | 851 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
|
852 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
853 assert(image_.get() != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
854 return (image_->GetBytesPerPixel() * image_->GetPitch() * image_->GetHeight()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
855 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
856 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
857 const Orthanc::ImageAccessor& GetImage() const |
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 assert(image_.get() != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
860 return *image_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
861 } |
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 unsigned int GetQuality() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
864 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
865 return quality_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
866 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
867 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
868 |
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 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
|
871 size_t frameNumber) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
872 { |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
873 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
|
874 } |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
877 Orthanc::MemoryObjectCache cache_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
878 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
879 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
880 FramesCache() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
881 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
882 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
|
883 //SetMaximumSize(1); // DISABLE CACHE |
1495
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
886 size_t GetMaximumSize() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
887 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
888 return cache_.GetMaximumSize(); |
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 void SetMaximumSize(size_t size) |
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 cache_.SetMaximumSize(size); |
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 * 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
|
898 * 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
|
899 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
900 bool Acquire(const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
901 size_t frameNumber, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
902 Orthanc::ImageAccessor* image /* transfer ownership */, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
903 unsigned int quality) |
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 std::unique_ptr<Orthanc::ImageAccessor> protection(image); |
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 if (image == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
908 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
909 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
910 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
911 else if (image->GetFormat() != Orthanc::PixelFormat_Float32 && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
912 image->GetFormat() != Orthanc::PixelFormat_RGB24) |
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 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); |
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 |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
917 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
|
918 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
919 bool invalidate = false; |
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 { |
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 * 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
|
924 * 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
|
925 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
926 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
|
927 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
928 if (accessor.IsValid()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
929 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
930 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
|
931 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
932 // 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
|
933 if (previous.GetQuality() < quality) |
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 // The previously stored image has poorer quality |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
936 invalidate = true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
937 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
938 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
939 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
940 // 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
|
941 return false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
942 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
943 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
944 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
945 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
946 invalidate = false; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
947 } |
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 if (invalidate) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
951 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
952 cache_.Invalidate(key); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
955 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
|
956 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
957 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
958 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
959 class Accessor : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
960 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
961 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
962 Orthanc::MemoryObjectCache::Accessor accessor_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
963 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
964 const CachedImage& GetCachedImage() const |
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 if (IsValid()) |
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 return dynamic_cast<CachedImage&>(accessor_.GetValue()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
969 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
970 else |
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 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
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 } |
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 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
977 Accessor(FramesCache& that, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
978 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
979 size_t frameNumber) : |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
980 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
|
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
984 bool IsValid() const |
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 return accessor_.IsValid(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
987 } |
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 const Orthanc::ImageAccessor& GetImage() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
990 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
991 return GetCachedImage().GetImage(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
992 } |
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 unsigned int GetQuality() const |
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 GetCachedImage().GetQuality(); |
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 }; |
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 |
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 class SeriesCursor : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1004 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1005 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1006 enum Action |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1007 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1008 Action_FastPlus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1009 Action_Plus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1010 Action_None, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1011 Action_Minus, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1012 Action_FastMinus |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1015 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1016 std::vector<size_t> prefetch_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1017 int framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1018 int currentFrame_; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1019 bool isCircularPrefetch_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1020 int fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1021 Action lastAction_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1022 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1023 int ComputeNextFrame(int currentFrame, |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1024 Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1025 bool isCircular) const |
1495
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 if (framesCount_ == 0) |
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 assert(currentFrame == 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1030 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1031 } |
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 int nextFrame = currentFrame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1034 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1035 switch (action) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1036 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1037 case Action_FastPlus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1038 nextFrame += fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1039 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1040 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1041 case Action_Plus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1042 nextFrame += 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1043 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1044 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1045 case Action_None: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1046 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1047 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1048 case Action_Minus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1049 nextFrame -= 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1050 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1051 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1052 case Action_FastMinus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1053 nextFrame -= fastDelta_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1054 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1055 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1056 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1057 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1058 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1059 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1060 if (isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1061 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1062 while (nextFrame < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1063 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1064 nextFrame += framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1065 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1066 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1067 while (nextFrame >= framesCount_) |
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 nextFrame -= framesCount_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1070 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1071 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1072 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1073 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1074 if (nextFrame < 0) |
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 nextFrame = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1077 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1078 else if (nextFrame >= framesCount_) |
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 nextFrame = framesCount_ - 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1081 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1082 } |
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 return nextFrame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1085 } |
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 void UpdatePrefetch() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1088 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1089 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1090 * 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
|
1091 * 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
|
1092 * 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
|
1093 * 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
|
1094 * will do the same action just afterwards. |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1095 **/ |
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 prefetch_.clear(); |
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 if (framesCount_ == 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1100 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1101 return; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1102 } |
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 prefetch_.reserve(framesCount_); |
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 // 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
|
1107 // 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
|
1108 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
|
1109 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1110 Queue queue; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1111 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
|
1112 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1113 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
|
1114 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1115 while (!queue.empty()) |
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 int frame = queue.front().first; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1118 Action previousAction = queue.front().second; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1119 queue.pop_front(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1120 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1121 if (visited.find(frame) == visited.end()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1122 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1123 visited.insert(frame); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1124 prefetch_.push_back(frame); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1125 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1126 switch (previousAction) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1127 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1128 case Action_None: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1129 case Action_Plus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1130 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
|
1131 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
|
1132 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
|
1133 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
|
1134 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1135 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1136 case Action_Minus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 break; |
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 case Action_FastPlus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1144 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
|
1145 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
|
1146 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
|
1147 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
|
1148 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1149 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1150 case Action_FastMinus: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1156 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1157 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1158 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1159 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1160 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1161 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1162 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1163 assert(prefetch_.size() == framesCount_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1164 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1165 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1166 bool CheckFrameIndex(int frame) const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1167 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1168 return ((framesCount_ == 0 && frame == 0) || |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1169 (framesCount_ > 0 && frame >= 0 && frame < framesCount_)); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1172 public: |
1573 | 1173 explicit SeriesCursor(size_t framesCount) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1174 framesCount_(framesCount), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1175 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
|
1176 isCircularPrefetch_(false), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1177 lastAction_(Action_None) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1178 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1179 SetFastDelta(framesCount / 20); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1180 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1181 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1182 |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1183 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
|
1184 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1185 return framesCount_; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1186 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
1187 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1188 void SetCircularPrefetch(bool isCircularPrefetch) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1189 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1190 isCircularPrefetch_ = isCircularPrefetch; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1191 UpdatePrefetch(); |
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 void SetFastDelta(int delta) |
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 fastDelta_ = (delta < 0 ? -delta : delta); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1197 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1198 if (fastDelta_ <= 0) |
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 fastDelta_ = 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1201 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1202 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1203 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1204 void SetCurrentIndex(size_t frame) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1205 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1206 if (frame >= framesCount_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1207 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1208 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
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 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1211 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1212 currentFrame_ = frame; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1213 lastAction_ = Action_None; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1214 UpdatePrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1215 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1216 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1217 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1218 size_t GetCurrentIndex() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1219 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1220 assert(CheckFrameIndex(currentFrame_)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1221 return static_cast<size_t>(currentFrame_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1222 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1223 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1224 void Apply(Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1225 bool isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1226 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1227 currentFrame_ = ComputeNextFrame(currentFrame_, action, isCircular); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1228 lastAction_ = action; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1229 UpdatePrefetch(); |
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 size_t GetPrefetchSize() const |
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 assert(prefetch_.size() == framesCount_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1235 return prefetch_.size(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1236 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1237 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1238 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
|
1239 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1240 if (i >= prefetch_.size()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1241 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1242 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
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 else |
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 assert(CheckFrameIndex(prefetch_[i])); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1247 return static_cast<size_t>(prefetch_[i]); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1248 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1249 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1250 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1251 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1252 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1253 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1254 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1255 /** |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1256 * 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
|
1257 * 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
|
1258 * checked by this function. |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
1259 **/ |
1646
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1260 static bool GetReferenceLineCoordinates(double& x1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1261 double& y1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1262 double& x2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1263 double& y2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1264 const OrthancStone::DicomInstanceParameters& instance1, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1265 unsigned int frame1, |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1266 const OrthancStone::CoordinateSystem3D& plane2) |
1646
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1267 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1268 if (instance1.GetWidth() == 0 && |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1269 instance1.GetHeight() == 0) |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1270 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1271 return false; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1272 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1273 else |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1274 { |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1275 /** |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1276 * Compute the 2D extent of the "instance1", expressed in |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1277 * 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
|
1278 * |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1279 * In a multiframe image (cf. "ExtractFrameOffsets()"), the plane of |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1280 * 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
|
1281 * 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
|
1282 * frame, so we can ignore the frame number. |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1283 **/ |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1284 OrthancStone::Extent2D extent; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1285 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1286 double ox = -instance1.GetPixelSpacingX() / 2.0; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1287 double oy = -instance1.GetPixelSpacingY() / 2.0; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1288 extent.AddPoint(ox, oy); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1289 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
|
1290 oy + instance1.GetPixelSpacingY() * static_cast<double>(instance1.GetHeight())); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1291 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1292 const OrthancStone::CoordinateSystem3D c1 = instance1.GetFrameGeometry(frame1); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1293 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1294 OrthancStone::Vector direction, origin; |
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 (!extent.IsEmpty() && |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1297 OrthancStone::GeometryToolbox::IntersectTwoPlanes(origin, direction, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1298 c1.GetOrigin(), c1.GetNormal(), |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
1299 plane2.GetOrigin(), plane2.GetNormal())) |
1646
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 double ax, ay, bx, by; |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1302 c1.ProjectPoint(ax, ay, origin); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1303 c1.ProjectPoint(bx, by, origin + 100.0 * direction); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1304 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1305 return OrthancStone::GeometryToolbox::ClipLineToRectangle( |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1306 x1, y1, x2, y2, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1307 ax, ay, bx, by, |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1308 extent.GetX1(), extent.GetY1(), extent.GetX2(), extent.GetY2()); |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1309 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1310 else |
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 return false; |
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 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1315 } |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1316 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1317 |
4e14735e98f8
preparing to remove FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1644
diff
changeset
|
1318 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1319 class StoneAnnotationsRegistry : public boost::noncopyable |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1320 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1321 private: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1322 class Index |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1323 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1324 private: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1325 std::string sopInstanceUid_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1326 size_t frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1327 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1328 public: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1329 Index(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1330 size_t frame) : |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1331 sopInstanceUid_(sopInstanceUid), |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1332 frame_(frame) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1333 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1334 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1335 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1336 const std::string& GetSopInstanceUid() const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1337 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1338 return sopInstanceUid_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1339 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1340 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1341 size_t GetFrame() const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1342 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1343 return frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1344 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1345 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1346 bool operator< (const Index& other) const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1347 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1348 if (sopInstanceUid_ < other.sopInstanceUid_) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1349 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1350 return true; |
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 else if (sopInstanceUid_ > other.sopInstanceUid_) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1353 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1354 return false; |
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 else |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1357 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1358 return frame_ < other.frame_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1359 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1360 } |
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 typedef std::map<Index, Json::Value*> Content; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1364 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1365 Content content_; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1366 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1367 void Clear() |
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 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
|
1370 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1371 assert(it->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1372 delete it->second; |
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 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1375 content_.clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1376 } |
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 StoneAnnotationsRegistry() |
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 } |
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 public: |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1383 ~StoneAnnotationsRegistry() |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1384 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1385 Clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1386 } |
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 static StoneAnnotationsRegistry& GetInstance() |
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 static StoneAnnotationsRegistry singleton; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1391 return singleton; |
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 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1394 void Save(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1395 size_t frame, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1396 const OrthancStone::AnnotationsSceneLayer& layer) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1397 { |
1814 | 1398 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
|
1399 layer.Serialize(*serialized); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1400 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1401 const Index index(sopInstanceUid, frame); |
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::iterator found = content_.find(index); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1404 if (found == content_.end()) |
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 content_[index] = serialized.release(); |
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 else |
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 assert(found->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1411 delete found->second; |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1412 found->second = serialized.release(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1413 } |
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 void Load(OrthancStone::AnnotationsSceneLayer& layer, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1417 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1418 size_t frame) const |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1419 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1420 const Index index(sopInstanceUid, frame); |
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 Content::const_iterator found = content_.find(index); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1423 if (found == content_.end()) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1424 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1425 layer.Clear(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1426 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1427 else |
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 assert(found->second != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1430 layer.Unserialize(*found->second); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1431 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1432 } |
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 |
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 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1437 class ViewerViewport : public OrthancStone::ObserverBase<ViewerViewport> |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1438 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1439 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1440 class IObserver : public boost::noncopyable |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1441 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1442 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1443 virtual ~IObserver() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1444 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1445 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1446 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1447 virtual void SignalSeriesDetailsReady(const ViewerViewport& viewport) = 0; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1448 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1449 virtual void SignalFrameUpdated(const ViewerViewport& viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1450 size_t currentFrame, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1451 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
|
1452 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
|
1453 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
|
1454 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
|
1455 const std::string& contentTime) = 0; |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
1456 |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
1457 // "click" is a 3D vector in world coordinates |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1458 virtual void SignalCrosshair(const ViewerViewport& viewport, |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1459 const OrthancStone::Vector& click) = 0; |
1694 | 1460 |
1461 virtual void SignalSynchronizedBrowsing(const ViewerViewport& viewport, | |
1462 const OrthancStone::Vector& click, | |
1463 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
|
1464 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1465 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
|
1466 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
|
1467 double windowingWidth) = 0; |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1468 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1469 virtual void SignalStoneAnnotationsChanged(const ViewerViewport& viewport, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1470 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1471 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
|
1472 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1473 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
|
1474 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
1475 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
|
1476 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1477 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1478 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1479 static const int LAYER_TEXTURE = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1480 static const int LAYER_REFERENCE_LINES = 1; |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
1481 static const int LAYER_ANNOTATIONS_OSIRIX = 2; |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
1482 static const int LAYER_ANNOTATIONS_STONE = 3; |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1607
diff
changeset
|
1483 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1484 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1485 class ICommand : public Orthanc::IDynamicObject |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1486 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1487 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1488 boost::shared_ptr<ViewerViewport> viewport_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1489 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1490 public: |
1573 | 1491 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
|
1492 viewport_(viewport) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1493 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1494 if (viewport == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1495 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1496 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1497 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1498 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1499 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1500 virtual ~ICommand() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1501 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1502 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1503 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1504 ViewerViewport& GetViewport() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1505 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1506 assert(viewport_ != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1507 return *viewport_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1508 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1509 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1510 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
|
1511 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1512 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1513 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1514 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1515 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
|
1516 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1517 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1518 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1519 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1520 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
|
1521 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1522 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1523 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1524 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1525 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1526 class LoadSeriesDetailsFromInstance : public ICommand |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1527 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1528 public: |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1529 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
|
1530 ICommand(viewport) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1531 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1532 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1533 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1534 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
|
1535 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1536 if (message.GetResources()->GetSize() != 1) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1537 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1538 throw Orthanc::OrthancException(Orthanc::ErrorCode_NetworkProtocol); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1539 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1540 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1541 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
|
1542 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1543 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1544 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
|
1545 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1546 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
|
1547 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
|
1548 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
|
1549 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1550 if (params.HasPixelSpacing()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1551 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1552 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
|
1553 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1554 else |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1555 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1556 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
|
1557 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1558 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1559 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
|
1560 params.GetPixelSpacingY() != 0 && |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1561 params.GetWidth() != 0 && |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1562 params.GetHeight()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1563 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1569 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1570 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
|
1571 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
|
1572 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1573 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
|
1574 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1575 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
|
1576 << ": " << params.GetWindowingPresetCenter(i) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1577 << "," << params.GetWindowingPresetWidth(i); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1578 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1579 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
|
1580 GetViewport().windowingPresetWidths_[i] = params.GetWindowingPresetWidth(i); |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1581 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
1582 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1583 if (params.GetWindowingPresetsCount() == 0) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1584 { |
1677
51bab5188a13
start multiple preset windowings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1676
diff
changeset
|
1585 LOG(INFO) << "No preset windowing"; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1586 } |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1587 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1588 GetViewport().SetWindowingPreset(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1589 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1590 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1591 uint32_t cineRate; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1592 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
|
1593 cineRate > 0) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1594 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1595 /** |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1596 * 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
|
1597 * instead of on the middle frame. |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1598 **/ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1599 GetViewport().cursor_->SetCurrentIndex(0); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1600 GetViewport().cineRate_ = cineRate; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1601 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1602 else |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1603 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1604 GetViewport().cineRate_ = DEFAULT_CINE_RATE; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1605 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1606 |
1668 | 1607 GetViewport().Redraw(); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1608 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1609 if (GetViewport().observer_.get() != NULL) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1610 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1611 GetViewport().observer_->SignalSeriesDetailsReady(GetViewport()); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1612 } |
1495
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 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
1616 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1617 class SetLowQualityFrame : public ICommand |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1618 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1619 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1620 std::string sopInstanceUid_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1621 unsigned int frameNumber_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1622 float windowCenter_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1623 float windowWidth_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1624 bool isMonochrome1_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1625 bool isPrefetch_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1626 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1627 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1628 SetLowQualityFrame(boost::shared_ptr<ViewerViewport> viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1629 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1630 unsigned int frameNumber, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1631 float windowCenter, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1632 float windowWidth, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1633 bool isMonochrome1, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1634 bool isPrefetch) : |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1635 ICommand(viewport), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1636 sopInstanceUid_(sopInstanceUid), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1637 frameNumber_(frameNumber), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1638 windowCenter_(windowCenter), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1639 windowWidth_(windowWidth), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1640 isMonochrome1_(isMonochrome1), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1641 isPrefetch_(isPrefetch) |
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::HttpCommand::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 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
|
1648 jpeg->ReadFromMemory(message.GetAnswer()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1649 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1650 std::unique_ptr<Orthanc::ImageAccessor> converted; |
1495
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 switch (jpeg->GetFormat()) |
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 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
|
1655 converted.reset(jpeg.release()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1656 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1657 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1658 case Orthanc::PixelFormat_Grayscale8: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1659 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1660 if (isMonochrome1_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1661 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1662 Orthanc::ImageProcessing::Invert(*jpeg); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1663 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1664 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1665 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
|
1666 jpeg->GetHeight(), false)); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1667 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1668 Orthanc::ImageProcessing::Convert(*converted, *jpeg); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1669 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1670 /** |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1671 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1672 Orthanc::ImageProcessing::ShiftScale() computes "(x + offset) * scaling". |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1673 The system to solve is thus: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1674 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1675 (0 + offset) * scaling = windowingCenter - windowingWidth / 2 [a] |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1676 (255 + offset) * scaling = windowingCenter + windowingWidth / 2 [b] |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1677 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1678 Resolution: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1679 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1680 [b - a] => 255 * scaling = windowingWidth |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1681 [a] => offset = (windowingCenter - windowingWidth / 2) / scaling |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1682 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1683 **/ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1684 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1685 const float scaling = windowWidth_ / 255.0f; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1686 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
|
1687 (windowCenter_ - windowWidth_ / 2.0f) / scaling); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1688 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1689 Orthanc::ImageProcessing::ShiftScale(*converted, offset, scaling, false); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1690 break; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1691 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1692 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1693 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1694 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1695 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1696 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1697 assert(converted.get() != NULL); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1698 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
|
1699 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
|
1700 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1701 if (isPrefetch_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1702 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1703 GetViewport().ScheduleNextPrefetch(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1704 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1705 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1706 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1707 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1708 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1709 class SetFullDicomFrame : public ICommand |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1710 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1711 private: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1712 std::string sopInstanceUid_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1713 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
|
1714 int priority_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1715 bool isPrefetch_; |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1716 bool serverSideTranscoding_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1717 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1718 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1719 SetFullDicomFrame(boost::shared_ptr<ViewerViewport> viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1720 const std::string& sopInstanceUid, |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1721 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
|
1722 int priority, |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1723 bool isPrefetch, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1724 bool serverSideTranscoding) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1725 ICommand(viewport), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1726 sopInstanceUid_(sopInstanceUid), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1727 frameNumber_(frameNumber), |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1728 priority_(priority), |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1729 isPrefetch_(isPrefetch), |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1730 serverSideTranscoding_(serverSideTranscoding) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1731 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1732 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1733 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1734 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
|
1735 { |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1736 std::unique_ptr<Orthanc::ImageAccessor> frame; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1737 |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1738 try |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1739 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1740 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
|
1741 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1742 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
|
1743 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1744 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
|
1745 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1746 if (!serverSideTranscoding_) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1747 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1748 // 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
|
1749 LOG(INFO) << "Switching to server-side transcoding"; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1750 GetViewport().serverSideTranscoding_ = true; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1751 GetViewport().ScheduleLoadFullDicomFrame(sopInstanceUid_, frameNumber_, priority_, isPrefetch_); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1752 } |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1753 return; |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1754 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1755 else |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1756 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1757 throw; |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1758 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
1759 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1760 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1761 if (frame.get() == NULL) |
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 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1764 } |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1765 else |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1766 { |
1855
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1767 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
|
1768 { |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1769 // 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
|
1770 // (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
|
1771 double windowingCenter, windowingWidth; |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1772 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
|
1773 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
|
1774 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
|
1775 GetViewport().SetWindowingPreset(); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1776 } |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1777 |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1778 Apply(GetViewport(), message.GetDicom(), frame.release(), sopInstanceUid_, frameNumber_); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1779 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1780 if (isPrefetch_) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1781 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1782 GetViewport().ScheduleNextPrefetch(); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1783 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1784 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1785 } |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1786 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1787 static void Apply(ViewerViewport& viewport, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1788 const Orthanc::ParsedDicomFile& dicom, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1789 Orthanc::ImageAccessor* f, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1790 const std::string& sopInstanceUid, |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1791 unsigned int frameNumber) |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1792 { |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1793 std::unique_ptr<Orthanc::ImageAccessor> frameProtection(f); |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1794 |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1795 Orthanc::DicomMap tags; |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1796 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
|
1797 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1798 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
|
1799 |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1800 if (frameProtection->GetFormat() == Orthanc::PixelFormat_RGB24) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1801 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1802 converted.reset(frameProtection.release()); |
1495
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 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1805 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1806 double a = 1; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1807 double b = 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1808 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1809 double doseScaling; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1810 if (tags.ParseDouble(doseScaling, Orthanc::DICOM_TAG_DOSE_GRID_SCALING)) |
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 a = doseScaling; |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1815 double rescaleIntercept, rescaleSlope; |
1855
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1816 dicom.GetRescale(rescaleIntercept, rescaleSlope, frameNumber); |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1817 a *= rescaleSlope; |
73a4bee08bb6
Support detection of windowing and rescale in Philips multiframe images
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1850
diff
changeset
|
1818 b = rescaleIntercept; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1819 |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
1820 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
|
1821 Orthanc::ImageProcessing::Convert(*converted, *frameProtection); |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1822 Orthanc::ImageProcessing::ShiftScale2(*converted, b, a, false); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1823 } |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1824 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1825 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
|
1826 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
|
1827 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
|
1828 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1829 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1830 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1831 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1832 class PrefetchItem |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1833 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1834 private: |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1835 size_t cursorIndex_; |
1670 | 1836 bool isFullQuality_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1837 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1838 public: |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1839 PrefetchItem(size_t cursorIndex, |
1670 | 1840 bool isFullQuality) : |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1841 cursorIndex_(cursorIndex), |
1670 | 1842 isFullQuality_(isFullQuality) |
1495
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 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1846 size_t GetCursorIndex() const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1847 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1848 return cursorIndex_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1849 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1850 |
1670 | 1851 bool IsFullQuality() const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1852 { |
1670 | 1853 return isFullQuality_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1854 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1855 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1856 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1857 |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1858 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
|
1859 OrthancStone::WebAssemblyLoadersContext& context_; |
1551
c54bc5bffd01
software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1549
diff
changeset
|
1860 boost::shared_ptr<OrthancStone::WebAssemblyViewport> viewport_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1861 boost::shared_ptr<OrthancStone::DicomResourcesLoader> loader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1862 OrthancStone::DicomSource source_; |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1863 boost::shared_ptr<FramesCache> framesCache_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1864 std::unique_ptr<OrthancStone::SortedFrames> frames_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1865 std::unique_ptr<SeriesCursor> cursor_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1866 float windowingCenter_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1867 float windowingWidth_; |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1868 std::vector<float> windowingPresetCenters_; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
1869 std::vector<float> windowingPresetWidths_; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
1870 unsigned int cineRate_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1871 bool inverted_; |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
1872 bool flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
1873 bool flipY_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1874 bool fitNextContent_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1875 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
|
1876 bool serverSideTranscoding_; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1877 OrthancStone::Vector synchronizationOffset_; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
1878 bool synchronizationEnabled_; |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
1879 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
|
1880 double centralPhysicalHeight_; |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1881 double centralPixelSpacingX_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
1882 double centralPixelSpacingY_; |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1883 |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1884 bool hasFocusOnInstance_; |
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
1885 std::string focusSopInstanceUid_; |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
1886 size_t focusFrameNumber_; |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
1887 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
1888 // 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
|
1889 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
|
1890 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
1891 // 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
|
1892 // 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
|
1893 // the center of the top-left pixel |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
1894 boost::shared_ptr<OrthancStone::AnnotationsSceneLayer> stoneAnnotations_; |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
1895 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
1896 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1897 void ScheduleNextPrefetch() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1898 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1899 while (!prefetchQueue_.empty()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1900 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1901 size_t cursorIndex = prefetchQueue_.front().GetCursorIndex(); |
1670 | 1902 bool isFullQuality = prefetchQueue_.front().IsFullQuality(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1903 prefetchQueue_.pop_front(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1904 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1905 const std::string sopInstanceUid = frames_->GetInstanceOfFrame(cursorIndex).GetSopInstanceUid(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1906 unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1907 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1908 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1909 FramesCache::Accessor accessor(*framesCache_, sopInstanceUid, frameNumber); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1910 if (!accessor.IsValid() || |
1670 | 1911 (isFullQuality && accessor.GetQuality() == 0)) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1912 { |
1670 | 1913 if (isFullQuality) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1914 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1915 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_NORMAL, true); |
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 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
1919 ScheduleLoadRenderedFrame(cursorIndex, PRIORITY_NORMAL, true); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1920 } |
1670 | 1921 |
1922 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
|
1923 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1924 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1925 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1926 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1927 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1928 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1929 void ClearViewport() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1930 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1931 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1932 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
|
1933 lock->GetController().GetScene().DeleteLayer(LAYER_TEXTURE); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1934 //lock->GetCompositor().Refresh(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1935 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1936 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1937 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1938 |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
1939 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1940 /** |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1941 * 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
|
1942 * 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
|
1943 **/ |
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1944 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
|
1945 DisplayedFrameQuality quality) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1946 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1947 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
|
1948 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1949 // Prepare prefetching |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1950 prefetchQueue_.clear(); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
1951 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1952 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
|
1953 { |
1680
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
1954 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
|
1955 size_t prefetchedSize = 0; |
03afa09cfcf1
running the tests of the Orthanc Framework in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1679
diff
changeset
|
1956 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
1957 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
|
1958 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
|
1959 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
1960 size_t a = cursor_->GetPrefetchIndex(i); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
1961 if (a != cursorIndex) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1962 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
1963 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
|
1964 prefetchedSize += frameSize; |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1965 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1966 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1967 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1968 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1969 ScheduleNextPrefetch(); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
1970 |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1971 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
|
1972 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
|
1973 observer_.get() != NULL) |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1974 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
1975 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
|
1976 |
1859
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1977 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
|
1978 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
|
1979 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
|
1980 |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1981 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
|
1982 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
|
1983 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
|
1984 |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
1985 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
|
1986 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1987 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1988 |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
1989 |
1668 | 1990 void RenderCurrentScene(const Orthanc::ImageAccessor& frame, |
1991 const OrthancStone::DicomInstanceParameters& instance, | |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
1992 size_t frameIndex, |
1668 | 1993 const OrthancStone::CoordinateSystem3D& plane) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1994 { |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
1995 /** |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
1996 * 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
|
1997 * "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
|
1998 * "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
|
1999 * 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
|
2000 * "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
|
2001 * "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
|
2002 * 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
|
2003 * (cf. LSD-479). |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2004 **/ |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2005 |
1668 | 2006 bool isMonochrome1 = (instance.GetImageInformation().GetPhotometricInterpretation() == |
2007 Orthanc::PhotometricInterpretation_Monochrome1); | |
2008 | |
2009 std::unique_ptr<OrthancStone::TextureBaseSceneLayer> layer; | |
2010 | |
2011 switch (frame.GetFormat()) | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2012 { |
1668 | 2013 case Orthanc::PixelFormat_RGB24: |
2014 layer.reset(new OrthancStone::ColorTextureSceneLayer(frame)); | |
2015 break; | |
2016 | |
2017 case Orthanc::PixelFormat_Float32: | |
2018 { | |
2019 std::unique_ptr<OrthancStone::FloatTextureSceneLayer> tmp( | |
2020 new OrthancStone::FloatTextureSceneLayer(frame)); | |
2021 tmp->SetCustomWindowing(windowingCenter_, windowingWidth_); | |
2022 tmp->SetInverted(inverted_ ^ isMonochrome1); | |
2023 layer.reset(tmp.release()); | |
2024 break; | |
2025 } | |
2026 | |
2027 default: | |
2028 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageFormat); | |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2029 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2030 |
1668 | 2031 assert(layer.get() != NULL); |
2032 | |
2033 layer->SetLinearInterpolation(true); | |
2034 layer->SetFlipX(flipX_); | |
2035 layer->SetFlipY(flipY_); | |
2036 | |
2037 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
|
2038 |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2039 if (instance.HasPixelSpacing()) |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2040 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2041 pixelSpacingX = instance.GetPixelSpacingX(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2042 pixelSpacingY = instance.GetPixelSpacingY(); |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2043 } |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2044 else |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2045 { |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2046 pixelSpacingX = centralPixelSpacingX_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2047 pixelSpacingY = centralPixelSpacingY_; |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2048 } |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2049 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2050 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
|
2051 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2052 /** |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2053 * 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
|
2054 * 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
|
2055 * 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
|
2056 * 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
|
2057 * 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
|
2058 **/ |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2059 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
|
2060 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
|
2061 |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2062 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
|
2063 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
|
2064 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2065 // 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
|
2066 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
|
2067 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2068 else |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2069 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2070 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
|
2071 centralPhysicalHeight_ / physicalHeight); |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2072 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
|
2073 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
|
2074 (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
|
2075 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2076 } |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2077 else |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2078 { |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2079 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
|
2080 } |
1668 | 2081 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2082 std::unique_ptr<OrthancStone::MacroSceneLayer> annotationsOsiriX; |
1668 | 2083 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2084 if (osiriXAnnotations_) |
1668 | 2085 { |
2086 std::set<size_t> a; | |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2087 osiriXAnnotations_->LookupSopInstanceUid(a, instance.GetSopInstanceUid()); |
1668 | 2088 if (plane.IsValid() && |
2089 !a.empty()) | |
2090 { | |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2091 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
|
2092 // annotationsOsiriX->Reserve(a.size()); |
1668 | 2093 |
2094 OrthancStone::OsiriXLayerFactory factory; | |
2095 factory.SetColor(0, 255, 0); | |
2096 | |
2097 for (std::set<size_t>::const_iterator it = a.begin(); it != a.end(); ++it) | |
2098 { | |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2099 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
|
2100 annotationsOsiriX->AddLayer(factory.Create(annotation, plane)); |
1668 | 2101 } |
2102 } | |
2103 } | |
2104 | |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2105 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frameIndex); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2106 |
1668 | 2107 { |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2108 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
|
2109 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2110 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
|
2111 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2112 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
|
2113 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2114 if (annotationsOsiriX.get() != NULL) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2115 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2116 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
|
2117 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2118 else |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2119 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2120 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
|
2121 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2122 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2123 stoneAnnotations_->Render(scene); // Necessary for "FitContent()" to work |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2124 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2125 if (fitNextContent_) |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2126 { |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2127 lock->RefreshCanvasSize(); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2128 lock->GetCompositor().FitContent(scene); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2129 stoneAnnotations_->Render(scene); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2130 fitNextContent_ = false; |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2131 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2132 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2133 //lock->GetCompositor().Refresh(scene); |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2134 lock->Invalidate(); |
1668 | 2135 } |
2136 } | |
2137 | |
2138 | |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2139 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
|
2140 const std::string& loadedSopInstanceUid, |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2141 unsigned int loadedFrameNumber, |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2142 DisplayedFrameQuality quality) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2143 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2144 if (cursor_.get() != NULL && |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2145 frames_.get() != NULL) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2146 { |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2147 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
|
2148 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2149 const size_t frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2150 |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2151 // 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
|
2152 if (instance.GetSopInstanceUid() == loadedSopInstanceUid && |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2153 frameNumber == loadedFrameNumber) |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2154 { |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2155 const OrthancStone::CoordinateSystem3D plane = frames_->GetFrameGeometry(cursorIndex); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2156 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2157 if (quality == DisplayedFrameQuality_Low) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2158 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2159 FramesCache::Accessor accessor(*framesCache_, instance.GetSopInstanceUid(), frameNumber); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2160 if (accessor.IsValid() && |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2161 accessor.GetQuality() == QUALITY_FULL) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2162 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2163 // 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
|
2164 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
|
2165 SetupPrefetchAfterRendering(frame, DisplayedFrameQuality_High); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2166 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2167 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2168 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2169 // 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
|
2170 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
|
2171 SetupPrefetchAfterRendering(frame, quality); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2172 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2173 /** |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2174 * The command "SetupPrefetchAfterRendering()" must be |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2175 * after "SetupPrefetchAfterRendering(quality)", as the |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2176 * DICOM instance might already be cached by the oracle, |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2177 * which makes a call to "observer_->SignalFrameUpdated()" |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2178 * with a low quality, whereas the high quality is |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2179 * available. |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2180 **/ |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2181 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2182 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2183 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2184 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2185 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2186 assert(quality == DisplayedFrameQuality_High); |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2187 SetupPrefetchAfterRendering(frame, quality); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2188 RenderCurrentScene(frame, instance, frameNumber, plane); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2189 } |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2190 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2191 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2192 } |
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2193 |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2194 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
|
2195 unsigned int frameNumber, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2196 int priority, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2197 bool isPrefetch) |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2198 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2199 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
|
2200 { |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2201 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
|
2202 lock->Schedule( |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2203 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
|
2204 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
|
2205 sopInstanceUid, serverSideTranscoding_, |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2206 Orthanc::DicomTransferSyntax_LittleEndianExplicit, |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2207 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
|
2208 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2209 } |
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2210 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2211 void ScheduleLoadFullDicomFrame(size_t cursorIndex, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2212 int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2213 bool isPrefetch) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2214 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2215 if (frames_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2216 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2217 std::string sopInstanceUid = frames_->GetInstanceOfFrame(cursorIndex).GetSopInstanceUid(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2218 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
|
2219 ScheduleLoadFullDicomFrame(sopInstanceUid, frameNumber, priority, isPrefetch); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2220 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2221 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2222 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2223 void ScheduleLoadRenderedFrame(size_t cursorIndex, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2224 int priority, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2225 bool isPrefetch) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2226 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2227 if (!source_.HasDicomWebRendered()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2228 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2229 ScheduleLoadFullDicomFrame(cursorIndex, priority, isPrefetch); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2230 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2231 else if (frames_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2232 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2233 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2234 unsigned int frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2235 |
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
|
2236 /** |
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
|
2237 * 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
|
2238 * 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
|
2239 * 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
|
2240 **/ |
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
|
2241 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
|
2242 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
|
2243 |
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
|
2244 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
|
2245 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
|
2246 { |
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
|
2247 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
|
2248 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2249 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
|
2250 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
|
2251 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
|
2252 } |
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
|
2253 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
|
2254 { |
1722
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2255 /** |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2256 * 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
|
2257 * 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
|
2258 * 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
|
2259 * the DICOM file using server-side transcoding. This |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2260 * happens on WRIX dataset. |
802cb1272f3a
fix for the WRIX dataset
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1721
diff
changeset
|
2261 **/ |
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
|
2262 } |
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
|
2263 } |
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
|
2264 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2265 bool isMonochrome1 = (instance.GetImageInformation().GetPhotometricInterpretation() == |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2266 Orthanc::PhotometricInterpretation_Monochrome1); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2267 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2268 const std::string uri = ("studies/" + frames_->GetStudyInstanceUid() + |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2269 "/series/" + frames_->GetSeriesInstanceUid() + |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2270 "/instances/" + instance.GetSopInstanceUid() + |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2271 "/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
|
2272 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2273 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
|
2274 // 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
|
2275 arguments["window"] = ( |
1536 | 2276 boost::lexical_cast<std::string>(windowingCenter_) + "," + |
2277 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
|
2278 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2279 std::unique_ptr<OrthancStone::IOracleCommand> command( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2280 source_.CreateDicomWebCommand( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2281 uri, arguments, headers, new SetLowQualityFrame( |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2282 GetSharedObserver(), instance.GetSopInstanceUid(), frameNumber, |
1536 | 2283 windowingCenter_, windowingWidth_, isMonochrome1, isPrefetch))); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2284 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2285 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2286 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
|
2287 lock->Schedule(GetSharedObserver(), priority, command.release()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2288 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2289 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2290 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2291 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2292 void UpdateCurrentTextureParameters() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2293 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2294 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
|
2295 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2296 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
|
2297 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2298 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
|
2299 OrthancStone::ISceneLayer::Type_FloatTexture) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2300 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2301 dynamic_cast<OrthancStone::FloatTextureSceneLayer&>( |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2302 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)). |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2303 SetCustomWindowing(windowingCenter_, windowingWidth_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2304 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2305 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2306 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2307 OrthancStone::TextureBaseSceneLayer& layer = |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2308 dynamic_cast<OrthancStone::TextureBaseSceneLayer&>( |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2309 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2310 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2311 layer.SetFlipX(flipX_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2312 layer.SetFlipY(flipY_); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2313 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2314 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2315 lock->Invalidate(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2316 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2317 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2318 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2319 |
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
|
2320 ViewerViewport(OrthancStone::WebAssemblyLoadersContext& context, |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2321 const OrthancStone::DicomSource& source, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2322 const std::string& canvas, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2323 boost::shared_ptr<FramesCache> cache, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2324 bool softwareRendering) : |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2325 context_(context), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2326 source_(source), |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2327 framesCache_(cache), |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2328 fitNextContent_(true), |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2329 flipX_(false), |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2330 flipY_(false), |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2331 hasFocusOnInstance_(false), |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2332 focusFrameNumber_(0), |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2333 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
|
2334 synchronizationEnabled_(false), |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2335 centralPhysicalWidth_(1), |
1822
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2336 centralPhysicalHeight_(1), |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2337 centralPixelSpacingX_(1), |
0489fe25ce48
support of pixel spacing in ultrasound images from tag SequenceOfUltrasoundRegions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1816
diff
changeset
|
2338 centralPixelSpacingY_(1) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2339 { |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2340 if (!framesCache_) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2341 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2342 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2343 } |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2344 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2345 if (softwareRendering) |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2346 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2347 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
|
2348 viewport_ = OrthancStone::WebAssemblyCairoViewport::Create(canvas); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2349 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2350 else |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2351 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2352 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
|
2353 viewport_ = OrthancStone::WebGLViewport::Create(canvas); |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2354 } |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2355 |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2356 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2357 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2358 std::string ttf; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2359 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
|
2360 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
|
2361 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2362 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2363 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
|
2364 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2365 SetWindowingPreset(); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2366 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2367 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
|
2368 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2369 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2370 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2371 void Handle(const OrthancStone::ViewportController::GrayscaleWindowingChanged& message) |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2372 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2373 // 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
|
2374 windowingCenter_ = message.GetWindowingCenter(); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2375 windowingWidth_ = message.GetWindowingWidth(); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2376 |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2377 if (observer_.get() != NULL) |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2378 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2379 observer_->SignalWindowingUpdated(*this, message.GetWindowingCenter(), message.GetWindowingWidth()); |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2380 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2381 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2382 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2383 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2384 static EM_BOOL OnWheel(int eventType, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2385 const EmscriptenWheelEvent *wheelEvent, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2386 void *userData) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2387 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2388 ViewerViewport& that = *reinterpret_cast<ViewerViewport*>(userData); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2389 |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2390 if (that.frames_.get() != NULL && |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2391 that.cursor_.get() != NULL) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2392 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2393 const bool isCtrl = wheelEvent->mouse.ctrlKey; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2394 const bool isShift = wheelEvent->mouse.shiftKey; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2395 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2396 const size_t previousCursorIndex = that.cursor_->GetCurrentIndex(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2397 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2398 if (wheelEvent->deltaY < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2399 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2400 that.ChangeFrame(isCtrl ? SeriesCursor::Action_FastMinus : |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2401 SeriesCursor::Action_Minus, false /* not circular */); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2402 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2403 else if (wheelEvent->deltaY > 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2404 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2405 that.ChangeFrame(isCtrl ? SeriesCursor::Action_FastPlus : |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2406 SeriesCursor::Action_Plus, false /* not circular */); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2407 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2408 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2409 if (that.synchronizationEnabled_) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2410 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2411 const size_t currentCursorIndex = that.cursor_->GetCurrentIndex(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2412 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2413 const OrthancStone::CoordinateSystem3D current = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2414 that.frames_->GetFrameGeometry(currentCursorIndex); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2415 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2416 if (isShift && |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2417 previousCursorIndex != currentCursorIndex) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2418 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2419 const OrthancStone::CoordinateSystem3D previous = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2420 that.frames_->GetFrameGeometry(previousCursorIndex); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2421 that.synchronizationOffset_ += previous.GetOrigin() - current.GetOrigin(); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2422 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2423 |
1694 | 2424 that.observer_->SignalSynchronizedBrowsing( |
2425 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
|
2426 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2427 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2428 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2429 return true; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2430 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2431 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2432 void Handle(const OrthancStone::DicomResourcesLoader::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2433 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2434 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
|
2435 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2436 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2437 void Handle(const OrthancStone::HttpCommand::SuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2438 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2439 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
|
2440 } |
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 void Handle(const OrthancStone::ParseDicomSuccessMessage& message) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2443 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2444 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
|
2445 } |
1600
b253b79906fa
clarifying variable names: frameIndex vs numberIndex
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
2446 |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2447 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2448 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
|
2449 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2450 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2451 std::unique_ptr<OrthancStone::IViewport::ILock> lock(viewport_->Lock()); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2452 stoneAnnotations_->Render(lock->GetController().GetScene()); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2453 lock->Invalidate(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2454 } |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2455 |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2456 if (save) |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2457 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2458 if (cursor_.get() != NULL && |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2459 frames_.get() != NULL) |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2460 { |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2461 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2462 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2463 const size_t frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2464 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2465 StoneAnnotationsRegistry::GetInstance().Save(instance.GetSopInstanceUid(), frameNumber, *stoneAnnotations_); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2466 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2467 if (observer_.get() != NULL) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2468 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2469 observer_->SignalStoneAnnotationsChanged(*this, instance.GetSopInstanceUid(), frameNumber); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2470 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2471 } |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2472 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2473 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2474 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2475 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
|
2476 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2477 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
|
2478 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2479 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2480 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
|
2481 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2482 RefreshAnnotations(true /* save */); |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2483 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2484 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2485 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
|
2486 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2487 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
|
2488 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2489 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
|
2490 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2491 observer_->SignalStoneAnnotationAdded(*this); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2492 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2493 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2494 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2495 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
|
2496 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2497 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
|
2498 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2499 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
|
2500 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2501 observer_->SignalStoneAnnotationRemoved(*this); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2502 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2503 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2504 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2505 public: |
1622
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2506 virtual ~ViewerViewport() |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2507 { |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2508 // 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
|
2509 // 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
|
2510 // 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
|
2511 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
|
2512 } |
0f8d6791b403
fix build by making the destructor of ViewerViewport public
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1620
diff
changeset
|
2513 |
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
|
2514 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
|
2515 const OrthancStone::DicomSource& source, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2516 const std::string& canvas, |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2517 boost::shared_ptr<FramesCache> cache, |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
2518 bool softwareRendering) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2519 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2520 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
|
2521 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
|
2522 |
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
|
2523 { |
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
|
2524 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
|
2525 |
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
|
2526 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
|
2527 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
|
2528 *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
|
2529 |
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
|
2530 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
|
2531 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
|
2532 |
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
|
2533 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
|
2534 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
|
2535 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2536 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationChangedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2537 *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
|
2538 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2539 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationAddedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2540 *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
|
2541 |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2542 viewport->Register<OrthancStone::AnnotationsSceneLayer::AnnotationRemovedMessage>( |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2543 *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
|
2544 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2545 |
1721
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2546 { |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2547 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
|
2548 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
|
2549 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
|
2550 } |
d4a8e2b19a65
new "GrayscaleWindowingChanged" message from GrayscaleWindowingSceneTracker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1720
diff
changeset
|
2551 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2552 return viewport; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2553 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2554 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2555 void SetFrames(OrthancStone::SortedFrames* frames) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2556 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2557 if (frames == NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2558 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2559 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2560 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2561 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2562 flipX_ = false; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2563 flipY_ = false; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2564 fitNextContent_ = true; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2565 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
|
2566 inverted_ = false; |
1682
84fe7089ccaa
switch to server-side transcoding on failed decoding (for jpeg2k)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
2567 serverSideTranscoding_ = false; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2568 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
|
2569 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2570 frames_.reset(frames); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2571 cursor_.reset(new SeriesCursor(frames_->GetFramesCount())); |
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 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
|
2574 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2575 SetWindowingPreset(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2576 ClearViewport(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2577 prefetchQueue_.clear(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2578 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2579 if (observer_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2580 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2581 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
|
2582 frames_->GetFramesCount(), DisplayedFrameQuality_None, 0, "", ""); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2583 } |
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
|
2584 |
1695
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2585 centralPhysicalWidth_ = 1; |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2586 centralPhysicalHeight_ = 1; |
a691ab50d416
support of series with instances of varying resolutions - LSD-479
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1694
diff
changeset
|
2587 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2588 if (frames_->GetFramesCount() != 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2589 { |
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
|
2590 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
|
2591 |
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
|
2592 /** |
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
|
2593 * 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
|
2594 * "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
|
2595 * 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
|
2596 * 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
|
2597 **/ |
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
|
2598 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
|
2599 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
|
2600 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
|
2601 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
|
2602 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
|
2603 GetSeriesThumbnailType(uid) != OrthancStone::SeriesThumbnailType_Video) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2604 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2605 // 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
|
2606 const std::string uri = ("studies/" + frames_->GetStudyInstanceUid() + |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2607 "/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
|
2608 "/instances/" + centralInstance.GetSopInstanceUid() + "/metadata"); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2609 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2610 loader_->ScheduleGetDicomWeb( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2611 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
|
2612 0, source_, uri, new LoadSeriesDetailsFromInstance(GetSharedObserver())); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2613 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2614 } |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2615 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
2616 ApplyScheduledFocus(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2617 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2618 |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
2619 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2620 // 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
|
2621 // 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
|
2622 void UpdateSize(bool fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2623 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2624 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
|
2625 lock->RefreshCanvasSize(); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2626 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2627 if (fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2628 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2629 lock->GetCompositor().FitContent(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2630 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2631 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2632 stoneAnnotations_->ClearHover(); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
2633 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
|
2634 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2635 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2636 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2637 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2638 void AcquireObserver(IObserver* observer) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2639 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2640 observer_.reset(observer); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2641 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2642 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2643 const std::string& GetCanvasId() const |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2644 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2645 assert(viewport_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2646 return viewport_->GetCanvasId(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2647 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2648 |
1669
d82a141e08d7
make the viewer work even if missing cache space
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
2649 |
1668 | 2650 void Redraw() |
2651 { | |
2652 if (cursor_.get() != NULL && | |
2653 frames_.get() != NULL) | |
2654 { | |
2655 const size_t cursorIndex = cursor_->GetCurrentIndex(); | |
2656 | |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2657 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2658 const size_t frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2659 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2660 FramesCache::Accessor accessor(*framesCache_, instance.GetSopInstanceUid(), frameNumber); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2661 if (accessor.IsValid()) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2662 { |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
2663 RenderCurrentScene(accessor.GetImage(), instance, frameNumber, frames_->GetFrameGeometry(cursorIndex)); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2664 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2665 DisplayedFrameQuality quality; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2666 |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2667 if (accessor.GetQuality() < QUALITY_FULL) |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2668 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2669 // 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
|
2670 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2671 quality = DisplayedFrameQuality_Low; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2672 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2673 else |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2674 { |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2675 quality = DisplayedFrameQuality_High; |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2676 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2677 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
2678 SetupPrefetchAfterRendering(accessor.GetImage(), quality); |
1671
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2679 } |
2c2512918a0f
fix in prefetching
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1670
diff
changeset
|
2680 else |
1668 | 2681 { |
2682 // This frame is not cached yet: Load it | |
2683 if (source_.HasDicomWebRendered()) | |
2684 { | |
2685 ScheduleLoadRenderedFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); | |
2686 } | |
2687 else | |
2688 { | |
2689 ScheduleLoadFullDicomFrame(cursorIndex, PRIORITY_HIGH, false /* not a prefetch */); | |
2690 } | |
2691 } | |
2692 } | |
2693 } | |
2694 | |
2695 | |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2696 // Returns "true" iff the frame has indeed changed |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2697 bool ChangeFrame(SeriesCursor::Action action, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2698 bool isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2699 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2700 if (cursor_.get() != NULL) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2701 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2702 size_t previous = cursor_->GetCurrentIndex(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2703 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2704 cursor_->Apply(action, isCircular); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2705 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2706 size_t current = cursor_->GetCurrentIndex(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2707 if (previous != current) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2708 { |
1668 | 2709 Redraw(); |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2710 return true; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2711 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2712 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2713 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2714 return false; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2715 } |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2716 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2717 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2718 void GoToFirstFrame() |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2719 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2720 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
|
2721 cursor_->GetCurrentIndex() != 0) |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2722 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2723 cursor_->SetCurrentIndex(0); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2724 Redraw(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2725 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2726 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2727 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2728 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2729 void GoToLastFrame() |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2730 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2731 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
|
2732 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2733 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
|
2734 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
|
2735 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2736 cursor_->SetCurrentIndex(last); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2737 Redraw(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2738 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2739 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
2740 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
2741 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2742 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2743 bool GetCurrentFrameOfReferenceUid(std::string& frameOfReferenceUid) const |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2744 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2745 if (cursor_.get() != NULL && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2746 frames_.get() != NULL) |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2747 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2748 frameOfReferenceUid = frames_->GetInstanceOfFrame(cursor_->GetCurrentIndex()).GetFrameOfReferenceUid(); |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2749 return true; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2750 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2751 else |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2752 { |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2753 return false; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2754 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2755 } |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2756 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2757 bool GetCurrentPlane(OrthancStone::CoordinateSystem3D& plane) const |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2758 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2759 if (cursor_.get() != NULL && |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2760 frames_.get() != NULL) |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2761 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2762 plane = frames_->GetFrameGeometry(cursor_->GetCurrentIndex()); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2763 return true; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2764 } |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2765 else |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2766 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2767 return false; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2768 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2769 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2770 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2771 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
|
2772 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2773 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
|
2774 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2775 if (cursor_.get() != NULL && |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2776 frames_.get() != NULL) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2777 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2778 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2779 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
2780 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
|
2781 |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2782 for (std::list<const ViewerViewport*>::const_iterator |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2783 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
|
2784 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2785 assert(*it != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2786 |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2787 OrthancStone::CoordinateSystem3D otherPlane; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2788 std::string otherFrameOfReferenceUid; |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2789 if ((*it)->GetCurrentPlane(otherPlane) && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2790 (*it)->GetCurrentFrameOfReferenceUid(otherFrameOfReferenceUid) && |
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2791 otherFrameOfReferenceUid == instance.GetFrameOfReferenceUid()) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2792 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2793 double x1, y1, x2, y2; |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
2794 if (GetReferenceLineCoordinates(x1, y1, x2, y2, instance, frame, otherPlane)) |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2795 { |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2796 OrthancStone::PolylineSceneLayer::Chain chain; |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2797 chain.push_back(OrthancStone::ScenePoint2D(x1, y1)); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2798 chain.push_back(OrthancStone::ScenePoint2D(x2, y2)); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2799 layer->AddChain(chain, false, 0, 255, 0); |
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2800 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2801 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2802 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2803 } |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
2804 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2805 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2806 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
|
2807 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2808 if (layer->GetChainsCount() == 0) |
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 lock->GetController().GetScene().DeleteLayer(LAYER_REFERENCE_LINES); |
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 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2813 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2814 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
|
2815 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2816 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2817 //lock->GetCompositor().Refresh(lock->GetController().GetScene()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2818 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2819 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2820 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2821 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2822 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2823 void ClearReferenceLines() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2824 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2825 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2826 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
|
2827 lock->GetController().GetScene().DeleteLayer(LAYER_REFERENCE_LINES); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2828 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2829 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2830 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2831 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2832 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
2833 void SetWindowingPreset() |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2834 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2835 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
|
2836 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2837 if (windowingPresetCenters_.empty()) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2838 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2839 SetWindowing(128, 256); |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2840 } |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2841 else |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
2842 { |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2843 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
|
2844 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2845 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2846 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2847 void SetWindowing(float windowingCenter, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2848 float windowingWidth) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2849 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2850 windowingCenter_ = windowingCenter; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2851 windowingWidth_ = windowingWidth; |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2852 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
|
2853 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2854 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
|
2855 { |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
2856 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
|
2857 } |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2858 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2859 |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2860 void FlipX() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2861 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2862 flipX_ = !flipX_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2863 UpdateCurrentTextureParameters(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2864 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2865 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2866 void FlipY() |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2867 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2868 flipY_ = !flipY_; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
2869 UpdateCurrentTextureParameters(); |
1495
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2872 void Invert() |
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 inverted_ = !inverted_; |
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 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2877 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
|
2878 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2879 if (lock->GetController().GetScene().HasLayer(LAYER_TEXTURE) && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2880 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE).GetType() == |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2881 OrthancStone::ISceneLayer::Type_FloatTexture) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2882 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2883 OrthancStone::FloatTextureSceneLayer& layer = |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2884 dynamic_cast<OrthancStone::FloatTextureSceneLayer&>( |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2885 lock->GetController().GetScene().GetLayer(LAYER_TEXTURE)); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2886 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2887 // 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
|
2888 // compatibility with MONOCHROME1 images |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2889 layer.SetInverted(!layer.IsInverted()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2890 lock->Invalidate(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2891 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2892 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2893 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
2894 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2895 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2896 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2897 class Interactor : public OrthancStone::DefaultViewportInteractor |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
2898 { |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2899 private: |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2900 ViewerViewport& viewer_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2901 WebViewerAction leftAction_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2902 WebViewerAction middleAction_; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2903 WebViewerAction rightAction_; |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2904 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2905 bool IsAction(const OrthancStone::PointerEvent& event, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2906 WebViewerAction action) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2907 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2908 switch (event.GetMouseButton()) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2909 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2910 case OrthancStone::MouseButton_Left: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2911 return (leftAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2912 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2913 case OrthancStone::MouseButton_Middle: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2914 return (middleAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2915 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2916 case OrthancStone::MouseButton_Right: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2917 return (rightAction_ == action); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2918 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2919 default: |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2920 return false; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2921 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2922 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
2923 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2924 public: |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2925 Interactor(ViewerViewport& viewer, |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2926 WebViewerAction leftAction, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2927 WebViewerAction middleAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2928 WebViewerAction rightAction) : |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2929 viewer_(viewer), |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2930 leftAction_(leftAction), |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2931 middleAction_(middleAction), |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2932 rightAction_(rightAction) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2933 { |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2934 SetLeftButtonAction(ConvertWebViewerAction(leftAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2935 SetMiddleButtonAction(ConvertWebViewerAction(middleAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2936 SetRightButtonAction(ConvertWebViewerAction(rightAction)); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2937 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
2938 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2939 virtual OrthancStone::IFlexiblePointerTracker* CreateTracker( |
1607 | 2940 boost::weak_ptr<OrthancStone::IViewport> viewport, |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2941 const OrthancStone::PointerEvent& event, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2942 unsigned int viewportWidth, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2943 unsigned int viewportHeight) ORTHANC_OVERRIDE |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2944 { |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2945 boost::shared_ptr<OrthancStone::IViewport> lock1(viewport.lock()); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2946 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2947 if (lock1 && |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2948 IsAction(event, WebViewerAction_Crosshair)) |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2949 { |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2950 OrthancStone::CoordinateSystem3D plane; |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2951 if (viewer_.GetCurrentPlane(plane)) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2952 { |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2953 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
|
2954 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2955 const OrthancStone::ScenePoint2D p = event.GetMainPosition(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2956 double x = p.GetX(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2957 double y = p.GetY(); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2958 lock2->GetController().GetCanvasToSceneTransform().Apply(x, y); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2959 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2960 OrthancStone::Vector click = plane.MapSliceToWorldCoordinates(x, y); |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2961 if (viewer_.observer_.get() != NULL) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2962 { |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
2963 viewer_.observer_->SignalCrosshair(viewer_, click); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2964 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2965 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
2966 |
1580 | 2967 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
|
2968 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2969 else |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
2970 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2971 // 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
|
2972 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
|
2973 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2974 switch (leftAction_) |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
2975 { |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2976 case WebViewerAction_CreateAngle: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2977 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
|
2978 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2979 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2980 case WebViewerAction_CreateCircle: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2981 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
|
2982 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2983 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2984 case WebViewerAction_CreateSegment: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2985 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
|
2986 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2987 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2988 case WebViewerAction_RemoveMeasure: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2989 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
|
2990 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2991 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2992 default: |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2993 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
|
2994 break; |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2995 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2996 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2997 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
2998 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
|
2999 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3000 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
|
3001 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
|
3002 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3003 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
|
3004 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3005 return t.release(); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3006 } |
1809
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3007 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3008 } |
79a5838739a6
starting the integration of AnnotationsSceneLayer into Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1795
diff
changeset
|
3009 |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3010 return DefaultViewportInteractor::CreateTracker( |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3011 viewport, event, viewportWidth, viewportHeight); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3012 } |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3013 } |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3014 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3015 virtual bool HasMouseHover() const ORTHANC_OVERRIDE |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3016 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3017 return true; |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3018 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3019 |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3020 virtual void HandleMouseHover(OrthancStone::IViewport& viewport, |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3021 const OrthancStone::PointerEvent& event) ORTHANC_OVERRIDE |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3022 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3023 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
|
3024 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3025 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
|
3026 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3027 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
|
3028 lock->Invalidate(); |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3029 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3030 } |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3031 }; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3032 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3033 |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3034 void SetMouseButtonActions(WebViewerAction leftAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3035 WebViewerAction middleAction, |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3036 WebViewerAction rightAction) |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3037 { |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3038 assert(viewport_ != NULL); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3039 viewport_->AcquireInteractor(new Interactor(*this, leftAction, middleAction, rightAction)); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3040 } |
1575 | 3041 |
1578 | 3042 void FitForPrint() |
1575 | 3043 { |
3044 viewport_->FitForPrint(); | |
3045 } | |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3046 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3047 void SetOsiriXAnnotations(boost::shared_ptr<OrthancStone::OsiriX::CollectionOfAnnotations> annotations) |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3048 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3049 osiriXAnnotations_ = annotations; |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3050 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3051 |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3052 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
|
3053 unsigned int frameNumber) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3054 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3055 hasFocusOnInstance_ = true; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3056 focusSopInstanceUid_ = sopInstanceUid; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3057 focusFrameNumber_ = frameNumber; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3058 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3059 ApplyScheduledFocus(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3060 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3061 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3062 void ApplyScheduledFocus() |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3063 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3064 size_t cursorIndex; |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3065 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3066 if (hasFocusOnInstance_ && |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3067 cursor_.get() != NULL && |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3068 frames_.get() != NULL && |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3069 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
|
3070 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3071 size_t current = cursor_->GetCurrentIndex(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3072 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3073 if (current != cursorIndex) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3074 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3075 cursor_->SetCurrentIndex(cursorIndex); |
1668 | 3076 Redraw(); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3077 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3078 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3079 hasFocusOnInstance_ = false; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3080 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3081 } |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3082 |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3083 void FocusOnPoint(const OrthancStone::Vector& p) |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3084 { |
1649
d77618883551
verification of FrameOfReferenceUID in reference lines
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1648
diff
changeset
|
3085 //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
|
3086 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
|
3087 |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3088 size_t cursorIndex; |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3089 if (cursor_.get() != NULL && |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3090 frames_.get() != NULL && |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3091 frames_->FindClosestFrame(cursorIndex, p, MAX_DISTANCE)) |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3092 { |
1667
9584df157a9e
clarifying variable names
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1666
diff
changeset
|
3093 cursor_->SetCurrentIndex(cursorIndex); |
1668 | 3094 Redraw(); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3095 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3096 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3097 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3098 unsigned int GetCineRate() const |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3099 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3100 return cineRate_; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3101 } |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3102 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3103 void FormatWindowingPresets(Json::Value& target) const |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3104 { |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3105 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
|
3106 |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3107 target = Json::arrayValue; |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3108 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3109 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
|
3110 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3111 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
|
3112 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
|
3113 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3114 std::string name = "Preset"; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3115 if (windowingPresetCenters_.size() > 1) |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3116 { |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3117 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
|
3118 } |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3119 |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3120 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
|
3121 preset["name"] = name; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3122 preset["center"] = c; |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3123 preset["width"] = w; |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3124 preset["info"] = |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3125 ("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
|
3126 ", 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
|
3127 |
1681
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3128 target.append(preset); |
f2e8b3ac1dcd
handling multiple windowing presets in the Stone web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
3129 } |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
3130 } |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3131 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3132 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3133 void SetSynchronizedBrowsingEnabled(int enabled) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3134 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3135 OrthancStone::LinearAlgebra::AssignVector(synchronizationOffset_, 0, 0, 0); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3136 synchronizationEnabled_ = enabled; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3137 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3138 |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3139 |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3140 void SignalStoneAnnotationsChanged(const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3141 size_t frame) |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3142 { |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3143 if (cursor_.get() != NULL && |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3144 frames_.get() != NULL) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3145 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3146 const size_t cursorIndex = cursor_->GetCurrentIndex(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3147 const OrthancStone::DicomInstanceParameters& instance = frames_->GetInstanceOfFrame(cursorIndex); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3148 const size_t frameNumber = frames_->GetFrameNumberInInstance(cursorIndex); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3149 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3150 if (instance.GetSopInstanceUid() == sopInstanceUid && |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3151 frameNumber == frame) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3152 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3153 StoneAnnotationsRegistry::GetInstance().Load(*stoneAnnotations_, instance.GetSopInstanceUid(), frame); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3154 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3155 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3156 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
|
3157 stoneAnnotations_->Render(lock->GetController().GetScene()); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3158 lock->Invalidate(); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3159 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3160 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3161 } |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3162 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3163 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3164 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3165 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3166 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3167 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3168 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3169 typedef std::map<std::string, boost::shared_ptr<ViewerViewport> > Viewports; |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3170 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3171 static Viewports allViewports_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3172 static bool showReferenceLines_ = true; |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3173 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
|
3174 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3175 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3176 static void UpdateReferenceLines() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3177 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3178 if (showReferenceLines_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3179 { |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3180 std::list<const ViewerViewport*> viewports; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3181 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3182 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
|
3183 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3184 assert(it->second != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3185 viewports.push_back(it->second.get()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3186 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3187 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3188 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
|
3189 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3190 assert(it->second != NULL); |
1647
adff3cd78775
removed class FrameExtent
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1646
diff
changeset
|
3191 it->second->UpdateReferenceLines(viewports); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3192 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3193 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3194 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3195 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3196 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
|
3197 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3198 assert(it->second != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3199 it->second->ClearReferenceLines(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3200 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3201 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3202 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3203 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3204 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3205 class WebAssemblyObserver : public ResourcesLoader::IObserver, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3206 public ViewerViewport::IObserver |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3207 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3208 public: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3209 virtual void SignalResourcesLoaded() ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3210 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3211 DISPATCH_JAVASCRIPT_EVENT("ResourcesLoaded"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3212 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3213 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3214 virtual void SignalSeriesThumbnailLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3215 const std::string& seriesInstanceUid) ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3216 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3217 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3218 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3219 customEvent.initCustomEvent("ThumbnailLoaded", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3220 { "studyInstanceUid" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3221 "seriesInstanceUid" : UTF8ToString($1) }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3222 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3223 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3224 studyInstanceUid.c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3225 seriesInstanceUid.c_str()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3226 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3227 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3228 virtual void SignalSeriesMetadataLoaded(const std::string& studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3229 const std::string& seriesInstanceUid) ORTHANC_OVERRIDE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3230 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3231 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3232 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3233 customEvent.initCustomEvent("MetadataLoaded", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3234 { "studyInstanceUid" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3235 "seriesInstanceUid" : UTF8ToString($1) }); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3236 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3237 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3238 studyInstanceUid.c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3239 seriesInstanceUid.c_str()); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3240 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3241 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
|
3242 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3243 assert(it->second != NULL); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3244 it->second->ApplyScheduledFocus(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3245 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3246 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3247 |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3248 virtual void SignalSeriesDetailsReady(const ViewerViewport& viewport) ORTHANC_OVERRIDE |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3249 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3250 EM_ASM({ |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3251 const customEvent = document.createEvent("CustomEvent"); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3252 customEvent.initCustomEvent("SeriesDetailsReady", false, false, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3253 { "canvasId" : UTF8ToString($0) }); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3254 window.dispatchEvent(customEvent); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3255 }, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3256 viewport.GetCanvasId().c_str() |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3257 ); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3258 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3259 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3260 virtual void SignalFrameUpdated(const ViewerViewport& viewport, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3261 size_t currentFrame, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3262 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
|
3263 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
|
3264 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
|
3265 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
|
3266 const std::string& contentTime) ORTHANC_OVERRIDE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3267 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3268 EM_ASM({ |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3269 const customEvent = document.createEvent("CustomEvent"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3270 customEvent.initCustomEvent("FrameUpdated", false, false, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3271 { "canvasId" : UTF8ToString($0), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3272 "currentFrame" : $1, |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
3273 "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
|
3274 "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
|
3275 "instanceNumber" : $4, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3276 "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
|
3277 "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
|
3278 }); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3279 window.dispatchEvent(customEvent); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3280 }, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3281 viewport.GetCanvasId().c_str(), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3282 static_cast<int>(currentFrame), |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3283 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
|
3284 quality, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3285 instanceNumber, |
58681a5c727b
overlay: display ContentDate/ContentTime instead of StudyDate if available + new 'TimeFormat' option
Alain Mazy <am@osimis.io>
parents:
1855
diff
changeset
|
3286 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
|
3287 contentTime.c_str()); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3288 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3289 UpdateReferenceLines(); |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3290 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3291 |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3292 virtual void SignalCrosshair(const ViewerViewport& viewport, |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3293 const OrthancStone::Vector& click) ORTHANC_OVERRIDE |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3294 { |
1811
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3295 if (click.size() != 3u) |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3296 { |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3297 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3298 } |
fdc6a8089eb9
hovering of annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1809
diff
changeset
|
3299 |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3300 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
|
3301 { |
1694 | 3302 // TODO - One could check the "Frame Of Reference UID" here |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3303 assert(it->second.get() != NULL); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3304 if (it->second.get() != &viewport) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3305 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3306 it->second->FocusOnPoint(click); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
3307 } |
1648
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3308 } |
4a43106bc122
cross-hair starts to work
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1647
diff
changeset
|
3309 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3310 |
1694 | 3311 virtual void SignalSynchronizedBrowsing(const ViewerViewport& viewport, |
3312 const OrthancStone::Vector& click, | |
3313 const OrthancStone::Vector& normal) ORTHANC_OVERRIDE | |
3314 { | |
3315 for (Viewports::const_iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) | |
3316 { | |
3317 assert(it->second.get() != NULL); | |
3318 | |
3319 OrthancStone::CoordinateSystem3D plane; | |
3320 bool isOpposite; | |
3321 | |
3322 if (it->second.get() != &viewport && | |
3323 it->second->GetCurrentPlane(plane) && | |
3324 OrthancStone::GeometryToolbox::IsParallelOrOpposite(isOpposite, plane.GetNormal(), normal)) | |
3325 { | |
3326 it->second->FocusOnPoint(click); | |
3327 } | |
3328 } | |
3329 } | |
3330 | |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3331 virtual void SignalSeriesPdfLoaded(const std::string& studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3332 const std::string& seriesInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3333 const std::string& pdf) ORTHANC_OVERRIDE |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3334 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3335 EM_ASM({ |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3336 const customEvent = document.createEvent("CustomEvent"); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3337 customEvent.initCustomEvent("PdfLoaded", false, false, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3338 { "studyInstanceUid" : UTF8ToString($0), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3339 "seriesInstanceUid" : UTF8ToString($1), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3340 "pdfPointer" : $2, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3341 "pdfSize": $3}); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3342 window.dispatchEvent(customEvent); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3343 }, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3344 studyInstanceUid.c_str(), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3345 seriesInstanceUid.c_str(), |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3346 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
|
3347 pdf.size()); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
3348 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3349 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3350 |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3351 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
|
3352 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
|
3353 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3354 std::string dataUriScheme; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3355 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
|
3356 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3357 EM_ASM({ |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3358 const customEvent = document.createEvent("CustomEvent"); |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3359 customEvent.initCustomEvent("VirtualSeriesThumbnailLoaded", false, false, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3360 { "virtualSeriesId" : UTF8ToString($0), |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3361 "thumbnail" : UTF8ToString($1) }); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3362 window.dispatchEvent(customEvent); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3363 }, |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3364 virtualSeriesId.c_str(), |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3365 dataUriScheme.c_str()); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
3366 } |
1720
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3367 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3368 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
|
3369 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
|
3370 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
|
3371 { |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3372 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
|
3373 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
|
3374 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
|
3375 { "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
|
3376 "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
|
3377 "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
|
3378 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
|
3379 }, |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3380 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
|
3381 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
|
3382 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
|
3383 |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3384 UpdateReferenceLines(); |
b8d19f53aaca
display the instance number, and the wc/ww info (work-in-progress)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1719
diff
changeset
|
3385 } |
1813
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3386 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3387 virtual void SignalStoneAnnotationsChanged(const ViewerViewport& viewport, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3388 const std::string& sopInstanceUid, |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3389 size_t frame) ORTHANC_OVERRIDE |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3390 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3391 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
|
3392 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3393 assert(it->second.get() != NULL); |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3394 |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3395 if (it->second.get() != &viewport) |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3396 { |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3397 it->second->SignalStoneAnnotationsChanged(sopInstanceUid, frame); |
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 } |
53aa3f72b539
synchronization of annotations across viewports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1812
diff
changeset
|
3400 } |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3401 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3402 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
|
3403 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3404 EM_ASM({ |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3405 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
|
3406 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
|
3407 { "canvasId" : UTF8ToString($0) }); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3408 window.dispatchEvent(customEvent); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3409 }, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3410 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
|
3411 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3412 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3413 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
|
3414 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3415 EM_ASM({ |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3416 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
|
3417 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
|
3418 { "canvasId" : UTF8ToString($0) }); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3419 window.dispatchEvent(customEvent); |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3420 }, |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3421 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
|
3422 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3423 }; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3424 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3425 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3426 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3427 static OrthancStone::DicomSource source_; |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
3428 static boost::shared_ptr<FramesCache> framesCache_; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3429 static boost::shared_ptr<OrthancStone::WebAssemblyLoadersContext> context_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3430 static std::string stringBuffer_; |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3431 static bool softwareRendering_ = false; |
1701
b5a8bf32d969
new configuration options: "CombinedToolEnabled", "CombinedToolBehaviour" and "DownloadAsJpegEnabled"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1695
diff
changeset
|
3432 static WebViewerAction leftButtonAction_ = WebViewerAction_Windowing; |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3433 static WebViewerAction middleButtonAction_ = WebViewerAction_Pan; |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3434 static WebViewerAction rightButtonAction_ = WebViewerAction_Zoom; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3435 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3436 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3437 static void FormatTags(std::string& target, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3438 const Orthanc::DicomMap& tags) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3439 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3440 Orthanc::DicomArray arr(tags); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3441 Json::Value v = Json::objectValue; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3442 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3443 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
|
3444 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3445 const Orthanc::DicomElement& element = arr.GetElement(i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3446 if (!element.GetValue().IsBinary() && |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3447 !element.GetValue().IsNull()) |
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 v[element.GetTag().Format()] = element.GetValue().GetContent(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3450 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3451 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3452 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3453 target = v.toStyledString(); |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3457 static ResourcesLoader& GetResourcesLoader() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3458 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3459 static boost::shared_ptr<ResourcesLoader> resourcesLoader_; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3460 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3461 if (!resourcesLoader_) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3462 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3463 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
|
3464 resourcesLoader_ = ResourcesLoader::Create(*lock, source_); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3465 resourcesLoader_->AcquireObserver(new WebAssemblyObserver); |
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 return *resourcesLoader_; |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3471 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3472 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
|
3473 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3474 Viewports::iterator found = allViewports_.find(canvas); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3475 if (found == allViewports_.end()) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3476 { |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3477 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
|
3478 ViewerViewport::Create(*context_, source_, canvas, framesCache_, softwareRendering_)); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3479 viewport->SetMouseButtonActions(leftButtonAction_, middleButtonAction_, rightButtonAction_); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3480 viewport->AcquireObserver(new WebAssemblyObserver); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3481 viewport->SetOsiriXAnnotations(osiriXAnnotations_); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3482 allViewports_[canvas] = viewport; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3483 return viewport; |
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 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3486 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3487 return found->second; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3488 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3489 } |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3492 extern "C" |
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 int main(int argc, char const *argv[]) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3495 { |
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
|
3496 printf("Initializing Stone\n"); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3497 Orthanc::InitializeFramework("", true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3498 Orthanc::Logging::EnableInfoLevel(true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3499 //Orthanc::Logging::EnableTraceLevel(true); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3500 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3501 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
|
3502 context_->SetDicomCacheSize(128 * 1024 * 1024); // 128MB |
fc883105ee11
enable cache of ParsedDicomFile in oracle
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1657
diff
changeset
|
3503 |
1676
5e76d5e8167a
limit the amount of frames to be prefetched
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1675
diff
changeset
|
3504 framesCache_.reset(new FramesCache); |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3505 osiriXAnnotations_.reset(new OrthancStone::OsiriX::CollectionOfAnnotations); |
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
3506 |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3507 DISPATCH_JAVASCRIPT_EVENT("StoneInitialized"); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3508 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3509 |
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 EMSCRIPTEN_KEEPALIVE |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3512 void SetDicomWebRoot(const char* uri, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3513 int useRendered) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3514 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3515 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3516 { |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3517 source_.SetDicomWebSource(uri); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3518 source_.SetDicomWebRendered(useRendered != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3519 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3520 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3521 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3522 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3523 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3524 EMSCRIPTEN_KEEPALIVE |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3525 void SetDicomWebThroughOrthanc(const char* orthancRoot, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3526 const char* serverName, |
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3527 int hasRendered) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3528 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3529 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3530 { |
1713
aec45e0b2528
configuration option "DicomWebRoot"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1704
diff
changeset
|
3531 context_->SetLocalOrthanc(orthancRoot); |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3532 source_.SetDicomWebThroughOrthancSource(serverName); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3533 source_.SetDicomWebRendered(hasRendered != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3534 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3535 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3536 } |
1761
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3537 |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3538 |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3539 EMSCRIPTEN_KEEPALIVE |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3540 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
|
3541 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
|
3542 { |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3543 try |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3544 { |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3545 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
|
3546 } |
28755e42c007
Fix issue #197 (Support for passing credentials with all HTTP requests)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
3547 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
|
3548 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3549 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3550 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3551 EMSCRIPTEN_KEEPALIVE |
1714
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3552 void SetDicomCacheSize(int sizeMB) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3553 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3554 try |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3555 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3556 if (sizeMB == 0) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3557 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3558 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
|
3559 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3560 else |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3561 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3562 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
|
3563 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3564 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3565 if (sizeMB >= 0) |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3566 { |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3567 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
|
3568 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3569 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3570 EXTERN_CATCH_EXCEPTIONS; |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3571 } |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3572 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3573 |
a878e807cd96
configuration option "DicomCacheSize", warning if cache should be larger
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1713
diff
changeset
|
3574 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3575 void FetchAllStudies() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3576 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3577 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3578 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3579 GetResourcesLoader().FetchAllStudies(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3580 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3581 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3582 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3583 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3584 EMSCRIPTEN_KEEPALIVE |
1702
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3585 void FetchPatient(const char* patientId) |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3586 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3587 try |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3588 { |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3589 GetResourcesLoader().FetchPatient(patientId); |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3590 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3591 EXTERN_CATCH_EXCEPTIONS; |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3592 } |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3593 |
bc40b6450261
"patient" GET argument
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1701
diff
changeset
|
3594 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3595 void FetchStudy(const char* studyInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3596 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3597 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3598 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3599 GetResourcesLoader().FetchStudy(studyInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3600 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3601 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3602 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3603 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3604 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3605 void FetchSeries(const char* studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3606 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3607 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3608 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3609 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3610 GetResourcesLoader().FetchSeries(studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3611 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3612 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3613 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3614 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3615 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3616 int GetStudiesCount() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3617 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3618 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3619 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3620 return GetResourcesLoader().GetStudiesCount(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3621 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3622 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3623 return 0; // on exception |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3624 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3625 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3626 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3627 int GetSeriesCount() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3628 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3629 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3630 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3631 return GetResourcesLoader().GetSeriesCount(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3632 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3633 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3634 return 0; // on exception |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3635 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3636 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3637 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3638 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3639 const char* GetStringBuffer() |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3640 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3641 return stringBuffer_.c_str(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3642 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3643 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3644 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3645 EMSCRIPTEN_KEEPALIVE |
1827
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3646 const char* GetStoneWebViewerVersion() |
1824
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
3647 { |
1827
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3648 return STONE_WEB_VIEWER_VERSION; |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3649 } |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3650 |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3651 |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3652 EMSCRIPTEN_KEEPALIVE |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3653 const char* GetEmscriptenVersion() |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3654 { |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3655 // 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
|
3656 // freed when returning to JavaScript |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3657 static const std::string EMSCRIPTEN_VERSION = ( |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3658 boost::lexical_cast<std::string>(__EMSCRIPTEN_major__) + "." + |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3659 boost::lexical_cast<std::string>(__EMSCRIPTEN_minor__) + "." + |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3660 boost::lexical_cast<std::string>(__EMSCRIPTEN_tiny__)); |
21ccc00839f7
upgrade to Emscripten 2.0.23
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1824
diff
changeset
|
3661 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
|
3662 } |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
3663 |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
3664 |
a56bf4c534ef
display stone web viewer version in info panel
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1822
diff
changeset
|
3665 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3666 void LoadStudyTags(int i) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3667 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3668 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3669 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3670 if (i < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3671 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3672 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3673 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3674 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3675 Orthanc::DicomMap dicom; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3676 GetResourcesLoader().GetStudy(dicom, i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3677 FormatTags(stringBuffer_, dicom); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3678 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3679 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3680 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3681 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3682 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3683 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3684 void LoadSeriesTags(int i) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3685 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3686 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3687 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3688 if (i < 0) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3689 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3690 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3691 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3692 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3693 Orthanc::DicomMap dicom; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3694 GetResourcesLoader().GetSeries(dicom, i); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3695 FormatTags(stringBuffer_, dicom); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3696 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3697 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3698 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3699 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3700 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3701 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3702 int LoadSeriesThumbnail(const char* seriesInstanceUid) |
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 try |
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 std::string image, mime; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3707 switch (GetResourcesLoader().GetSeriesThumbnail(image, mime, seriesInstanceUid)) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3708 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3709 case OrthancStone::SeriesThumbnailType_Image: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3710 Orthanc::Toolbox::EncodeDataUriScheme(stringBuffer_, mime, image); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3711 return ThumbnailType_Image; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3712 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3713 case OrthancStone::SeriesThumbnailType_Pdf: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3714 return ThumbnailType_Pdf; |
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 case OrthancStone::SeriesThumbnailType_Video: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3717 return ThumbnailType_Video; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3718 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3719 case OrthancStone::SeriesThumbnailType_NotLoaded: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3720 return ThumbnailType_Loading; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3721 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3722 case OrthancStone::SeriesThumbnailType_Unsupported: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3723 return ThumbnailType_NoPreview; |
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 default: |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3726 return ThumbnailType_Unknown; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3727 } |
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 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3730 return ThumbnailType_Unknown; |
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 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3734 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3735 void SpeedUpFetchSeriesMetadata(const char* studyInstanceUid, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3736 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3737 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3738 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3739 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3740 GetResourcesLoader().FetchSeriesMetadata(PRIORITY_HIGH, studyInstanceUid, seriesInstanceUid); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3741 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3742 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3743 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3744 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3745 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3746 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3747 int IsSeriesComplete(const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3748 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3749 try |
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 return GetResourcesLoader().IsSeriesComplete(seriesInstanceUid) ? 1 : 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3752 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3753 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3754 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3755 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3756 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3757 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3758 int LoadSeriesInViewport(const char* canvas, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3759 const char* seriesInstanceUid) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3760 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3761 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3762 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3763 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
|
3764 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3765 if (GetResourcesLoader().SortSeriesFrames(*frames, seriesInstanceUid)) |
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 GetViewport(canvas)->SetFrames(frames.release()); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3768 return 1; |
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 else |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3771 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3772 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3773 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3774 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3775 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3776 return 0; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3777 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3778 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3779 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3780 EMSCRIPTEN_KEEPALIVE |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3781 int LoadVirtualSeriesInViewport(const char* canvas, |
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
3782 const char* virtualSeriesId) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3783 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3784 try |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3785 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3786 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
|
3787 |
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
|
3788 if (GetResourcesLoader().SortVirtualSeriesFrames(*frames, virtualSeriesId)) |
1704
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3789 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3790 GetViewport(canvas)->SetFrames(frames.release()); |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3791 return 1; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3792 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3793 else |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3794 { |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3795 return 0; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3796 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3797 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3798 EXTERN_CATCH_EXCEPTIONS; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3799 return 0; |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3800 } |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3801 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3802 |
902d13889ae4
LoadMultipartInstanceInViewport() in C++
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1703
diff
changeset
|
3803 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3804 void AllViewportsUpdateSize(int fitContent) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3805 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3806 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3807 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3808 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
|
3809 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3810 assert(it->second != NULL); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3811 it->second->UpdateSize(fitContent != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3812 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3813 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3814 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3815 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3816 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3817 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3818 EMSCRIPTEN_KEEPALIVE |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3819 int DecrementFrame(const char* canvas, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3820 int isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3821 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3822 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3823 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3824 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
|
3825 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3826 EXTERN_CATCH_EXCEPTIONS; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3827 return 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3828 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3829 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3830 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3831 EMSCRIPTEN_KEEPALIVE |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3832 int IncrementFrame(const char* canvas, |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3833 int isCircular) |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3834 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3835 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3836 { |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3837 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
|
3838 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3839 EXTERN_CATCH_EXCEPTIONS; |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
3840 return 0; |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3841 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3842 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3843 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3844 EMSCRIPTEN_KEEPALIVE |
1719
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3845 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
|
3846 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3847 try |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3848 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3849 GetViewport(canvas)->GoToFirstFrame(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3850 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3851 EXTERN_CATCH_EXCEPTIONS; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3852 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3853 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3854 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3855 EMSCRIPTEN_KEEPALIVE |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3856 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
|
3857 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3858 try |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3859 { |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3860 GetViewport(canvas)->GoToLastFrame(); |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3861 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3862 EXTERN_CATCH_EXCEPTIONS; |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3863 } |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3864 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3865 |
9a1f79d21a3f
added buttons to go to the first and last frames
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1717
diff
changeset
|
3866 EMSCRIPTEN_KEEPALIVE |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3867 void ShowReferenceLines(int show) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3868 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3869 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3870 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3871 showReferenceLines_ = (show != 0); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3872 UpdateReferenceLines(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3873 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3874 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3875 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3876 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3877 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3878 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3879 void SetWindowing(const char* canvas, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3880 int center, |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3881 int width) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3882 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3883 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3884 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3885 GetViewport(canvas)->SetWindowing(center, width); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3886 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3887 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3888 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3889 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3890 |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3891 EMSCRIPTEN_KEEPALIVE |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3892 void InvertContrast(const char* canvas) |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3893 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3894 try |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3895 { |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3896 GetViewport(canvas)->Invert(); |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3897 } |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3898 EXTERN_CATCH_EXCEPTIONS; |
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3899 } |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3900 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3901 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3902 EMSCRIPTEN_KEEPALIVE |
1554
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3903 void FlipX(const char* canvas) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3904 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3905 try |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3906 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3907 GetViewport(canvas)->FlipX(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3908 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3909 EXTERN_CATCH_EXCEPTIONS; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3910 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3911 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3912 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3913 EMSCRIPTEN_KEEPALIVE |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3914 void FlipY(const char* canvas) |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3915 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3916 try |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3917 { |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3918 GetViewport(canvas)->FlipY(); |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3919 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3920 EXTERN_CATCH_EXCEPTIONS; |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3921 } |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3922 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3923 |
6d14ed6163b1
flip x/y in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1552
diff
changeset
|
3924 EMSCRIPTEN_KEEPALIVE |
1552
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3925 void SetSoftwareRendering(int softwareRendering) |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3926 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3927 softwareRendering_ = softwareRendering; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3928 } |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3929 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3930 |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3931 EMSCRIPTEN_KEEPALIVE |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3932 int IsSoftwareRendering() |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3933 { |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3934 return softwareRendering_; |
a4d82f1bcb10
user preferences: not for diagnostic use, software rendering
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1551
diff
changeset
|
3935 } |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3936 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3937 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3938 EMSCRIPTEN_KEEPALIVE |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3939 void SetMouseButtonActions(int leftAction, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3940 int middleAction, |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3941 int rightAction) |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3942 { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3943 try |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3944 { |
1579
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3945 leftButtonAction_ = static_cast<WebViewerAction>(leftAction); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3946 middleButtonAction_ = static_cast<WebViewerAction>(middleAction); |
c476b0d5e59c
skeleton for cross-hair tool
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1578
diff
changeset
|
3947 rightButtonAction_ = static_cast<WebViewerAction>(rightAction); |
1561
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3948 |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3949 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3950 { |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3951 assert(it->second != NULL); |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3952 it->second->SetMouseButtonActions(leftButtonAction_, middleButtonAction_, rightButtonAction_); |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3953 } |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3954 } |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3955 EXTERN_CATCH_EXCEPTIONS; |
cf652990abb1
tunable mouse actions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1558
diff
changeset
|
3956 } |
1575 | 3957 |
3958 | |
3959 EMSCRIPTEN_KEEPALIVE | |
1815
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3960 int GetLeftMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3961 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3962 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
|
3963 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3964 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3965 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3966 EMSCRIPTEN_KEEPALIVE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3967 int GetMiddleMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3968 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3969 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
|
3970 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3971 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3972 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3973 EMSCRIPTEN_KEEPALIVE |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3974 int GetRightMouseButtonAction() |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3975 { |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3976 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
|
3977 } |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3978 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3979 |
b81775f1b196
New tools for annotations: segment length, circle, angle and eraser
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1814
diff
changeset
|
3980 EMSCRIPTEN_KEEPALIVE |
1578 | 3981 void FitForPrint() |
1575 | 3982 { |
3983 try | |
3984 { | |
3985 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) | |
3986 { | |
3987 assert(it->second != NULL); | |
3988 it->second->FitForPrint(); | |
3989 } | |
3990 } | |
3991 EXTERN_CATCH_EXCEPTIONS; | |
3992 } | |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3993 |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3994 |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
3995 // 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
|
3996 // Instance UID" of the first loaded annotation |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3997 EMSCRIPTEN_KEEPALIVE |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3998 int LoadOsiriXAnnotations(const char* xml, |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
3999 int clearPreviousAnnotations) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4000 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4001 try |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4002 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4003 if (clearPreviousAnnotations) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4004 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4005 osiriXAnnotations_->Clear(); |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4006 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4007 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4008 osiriXAnnotations_->LoadXml(xml); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4009 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4010 // Force redraw, as the annotations might have changed |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4011 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4012 { |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4013 assert(it->second != NULL); |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4014 it->second->Redraw(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4015 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4016 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4017 if (osiriXAnnotations_->GetSize() == 0) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4018 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4019 stringBuffer_.clear(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4020 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4021 else |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4022 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4023 stringBuffer_ = osiriXAnnotations_->GetAnnotation(0).GetSeriesInstanceUid(); |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4024 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4025 |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4026 LOG(WARNING) << "Loaded " << osiriXAnnotations_->GetSize() << " annotations from OsiriX"; |
1593
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4027 return 1; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4028 } |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4029 EXTERN_CATCH_EXCEPTIONS; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4030 return 0; |
b782f78aed42
rendering osirix annotations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1591
diff
changeset
|
4031 } |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4032 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4033 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4034 EMSCRIPTEN_KEEPALIVE |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4035 void FocusFirstOsiriXAnnotation(const char* canvas) |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4036 { |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4037 try |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4038 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4039 if (osiriXAnnotations_->GetSize() != 0) |
1603
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4040 { |
1812
db341679dc9f
ViewerViewport::StoneAnnotationsRegistry
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1811
diff
changeset
|
4041 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
|
4042 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4043 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
|
4044 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
|
4045 |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4046 // 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
|
4047 viewport->Redraw(); |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4048 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4049 } |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4050 EXTERN_CATCH_EXCEPTIONS; |
595c0952ef7e
focusing on osirix annotations in Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1600
diff
changeset
|
4051 } |
1657
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4052 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4053 |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4054 EMSCRIPTEN_KEEPALIVE |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4055 void FetchPdf(const char* studyInstanceUid, |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4056 const char* seriesInstanceUid) |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4057 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4058 try |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4059 { |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4060 LOG(INFO) << "Fetching PDF series: " << seriesInstanceUid; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4061 GetResourcesLoader().FetchPdf(studyInstanceUid, seriesInstanceUid); |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4062 } |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4063 EXTERN_CATCH_EXCEPTIONS; |
66e5fcdf5597
pdf viewer is working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1654
diff
changeset
|
4064 } |
1672
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4065 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4066 |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4067 EMSCRIPTEN_KEEPALIVE |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4068 unsigned int GetCineRate(const char* canvas) |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4069 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4070 try |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4071 { |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4072 return GetViewport(canvas)->GetCineRate(); |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4073 } |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4074 EXTERN_CATCH_EXCEPTIONS; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4075 return 0; |
570398585b5f
start support of cine sequences
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1671
diff
changeset
|
4076 } |
1674
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4077 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4078 |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4079 EMSCRIPTEN_KEEPALIVE |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4080 unsigned int GetSeriesNumberOfFrames(const char* seriesInstanceUid) |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4081 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4082 try |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4083 { |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4084 return GetResourcesLoader().GetSeriesNumberOfFrames(seriesInstanceUid); |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4085 } |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4086 EXTERN_CATCH_EXCEPTIONS; |
0621e523b670
number of frames in badge
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1672
diff
changeset
|
4087 return 0; |
1679
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4088 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4089 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4090 |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4091 EMSCRIPTEN_KEEPALIVE |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4092 void LoadWindowingPresets(const char* canvas) |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4093 { |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4094 try |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4095 { |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4096 Json::Value v; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4097 GetViewport(canvas)->FormatWindowingPresets(v); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4098 stringBuffer_ = v.toStyledString(); |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4099 } |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4100 EXTERN_CATCH_EXCEPTIONS; |
5b8b88e5bfd6
successfully running unit tests in WebAssembly
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1677
diff
changeset
|
4101 } |
1693
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4102 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4103 |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4104 EMSCRIPTEN_KEEPALIVE |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4105 void SetSynchronizedBrowsingEnabled(int enabled) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4106 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4107 try |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4108 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4109 for (Viewports::iterator it = allViewports_.begin(); it != allViewports_.end(); ++it) |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4110 { |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4111 assert(it->second != NULL); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4112 it->second->SetSynchronizedBrowsingEnabled(enabled); |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4113 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4114 } |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4115 EXTERN_CATCH_EXCEPTIONS; |
eafb10992e73
synchronized browsing
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
4116 } |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4117 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4118 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4119 EMSCRIPTEN_KEEPALIVE |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4120 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
|
4121 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4122 try |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4123 { |
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
|
4124 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
|
4125 |
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
|
4126 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
|
4127 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
|
4128 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4129 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
|
4130 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
|
4131 { |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4132 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
|
4133 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
|
4134 item["NumberOfFrames"] = it->second; |
1849
023cce3d7844
introduction of the concept of "virtual series"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1827
diff
changeset
|
4135 json.append(item); |
1703
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4136 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4137 |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4138 stringBuffer_ = json.toStyledString(); |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4139 return true; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4140 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4141 else |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4142 { |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4143 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4144 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4145 } |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4146 EXTERN_CATCH_EXCEPTIONS; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4147 return false; |
76c590a62755
start work on series with multiple multiframe instances
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1702
diff
changeset
|
4148 } |
1495
fb74ed5d8c22
initial commit of the Stone Web viewer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4149 } |