Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyScene.h @ 1395:62dc0d737e7b
build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 18:11:49 +0200 |
parents | 6ea4062c1a0d |
children |
rev | line source |
---|---|
408 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1259
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
408 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
24 #include "RadiographyLayer.h" |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1038
diff
changeset
|
25 #include "../Messages/ObserverBase.h" |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
26 #include "../Deprecated/Toolbox/DicomFrameConverter.h" |
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
27 #include "../Deprecated/Toolbox/OrthancApiClient.h" |
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
28 #include "../StoneEnumerations.h" |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
29 #include "Core/Images/Image.h" |
488 | 30 #include "Core/Images/ImageProcessing.h" |
408 | 31 |
1373
e0cdf8688d56
wip: from RadiographyScene to Scene2D
Alain Mazy <alain@mazy.be>
parents:
1330
diff
changeset
|
32 #include "../Scene2D/Scene2D.h" |
e0cdf8688d56
wip: from RadiographyScene to Scene2D
Alain Mazy <alain@mazy.be>
parents:
1330
diff
changeset
|
33 |
408 | 34 namespace OrthancStone |
35 { | |
475
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
36 class RadiographyDicomLayer; |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
37 |
408 | 38 class RadiographyScene : |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1038
diff
changeset
|
39 public ObserverBase<RadiographyScene>, |
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1038
diff
changeset
|
40 public IObservable |
408 | 41 { |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
42 friend class RadiographySceneGeometryReader; |
408 | 43 public: |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
44 class GeometryChangedMessage : public OriginMessage<RadiographyScene> |
430 | 45 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
46 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
47 |
430 | 48 private: |
49 RadiographyLayer& layer_; | |
50 | |
51 public: | |
52 GeometryChangedMessage(const RadiographyScene& origin, | |
53 RadiographyLayer& layer) : | |
54 OriginMessage(origin), | |
55 layer_(layer) | |
56 { | |
57 } | |
58 | |
59 RadiographyLayer& GetLayer() const | |
60 { | |
61 return layer_; | |
62 } | |
63 }; | |
64 | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
65 class ContentChangedMessage : public OriginMessage<RadiographyScene> |
430 | 66 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
67 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
68 |
430 | 69 private: |
70 RadiographyLayer& layer_; | |
71 | |
72 public: | |
73 ContentChangedMessage(const RadiographyScene& origin, | |
438 | 74 RadiographyLayer& layer) : |
430 | 75 OriginMessage(origin), |
76 layer_(layer) | |
77 { | |
78 } | |
79 | |
80 RadiographyLayer& GetLayer() const | |
81 { | |
82 return layer_; | |
83 } | |
84 }; | |
85 | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
86 class LayerEditedMessage : public OriginMessage<RadiographyScene> |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
87 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
88 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
89 |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
90 private: |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
91 const RadiographyLayer& layer_; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
92 |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
93 public: |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
94 LayerEditedMessage(const RadiographyScene& origin, |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
95 const RadiographyLayer& layer) : |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
96 OriginMessage(origin), |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
97 layer_(layer) |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
98 { |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
99 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
100 |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
101 const RadiographyLayer& GetLayer() const |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
102 { |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
103 return layer_; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
104 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
105 }; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
106 |
1131
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
107 class LayerRemovedMessage : public OriginMessage<RadiographyScene> |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
108 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
109 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
110 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
111 private: |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
112 size_t& layerIndex_; |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
113 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
114 public: |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
115 LayerRemovedMessage(const RadiographyScene& origin, |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
116 size_t& layerIndex) : |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
117 OriginMessage(origin), |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
118 layerIndex_(layerIndex) |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
119 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
120 } |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
121 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
122 size_t& GetLayerIndex() const |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
123 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
124 return layerIndex_; |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
125 } |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
126 }; |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
127 |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
128 |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
129 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, WindowingChangedMessage, RadiographyScene); |
408 | 130 |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
131 |
408 | 132 class LayerAccessor : public boost::noncopyable |
133 { | |
134 private: | |
135 RadiographyScene& scene_; | |
136 size_t index_; | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
137 RadiographyLayer* layer_; |
408 | 138 |
139 public: | |
140 LayerAccessor(RadiographyScene& scene, | |
141 size_t index); | |
142 | |
143 LayerAccessor(RadiographyScene& scene, | |
144 double x, | |
145 double y); | |
146 | |
147 void Invalidate() | |
148 { | |
149 layer_ = NULL; | |
150 } | |
151 | |
152 bool IsValid() const | |
153 { | |
154 return layer_ != NULL; | |
155 } | |
156 | |
157 RadiographyScene& GetScene() const; | |
158 | |
159 size_t GetIndex() const; | |
160 | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
161 RadiographyLayer& GetLayer() const; |
408 | 162 }; |
163 | |
164 | |
452
9a8fe40acfff
improved inheritence of RadiographyScene
Alain Mazy <alain@mazy.be>
parents:
440
diff
changeset
|
165 protected: |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
166 typedef std::map<size_t, RadiographyLayer*> Layers; |
408 | 167 |
1199
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
1196
diff
changeset
|
168 size_t nextLayerIndex_; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
169 bool hasWindowing_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
170 float windowingCenter_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
171 float windowingWidth_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
172 Layers layers_; |
408 | 173 |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
174 public: |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
175 RadiographyLayer& RegisterLayer(RadiographyLayer* layer); |
408 | 176 |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
177 protected: |
1257
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
178 virtual void _RegisterLayer(RadiographyLayer* layer); |
1272
a989c7d46b9a
options to avoid multiple LayerEditedMessage
Alain Mazy <alain@mazy.be>
parents:
1259
diff
changeset
|
179 virtual void _OnLayerRemoved() {} |
1257
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
180 |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
181 void SetLayerIndex(RadiographyLayer* layer, size_t index) |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
182 { |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
183 layer->SetIndex(index); |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
184 } |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
185 |
1118
35e798b16b65
RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents:
1038
diff
changeset
|
186 virtual void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); |
408 | 187 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
188 virtual void OnFrameReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); |
408 | 189 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
190 void OnDicomExported(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message); |
408 | 191 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
192 void OnDicomWebReceived(const Deprecated::IWebService::HttpRequestSuccessMessage& message); |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
193 |
730
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
194 virtual void OnLayerEdited(const RadiographyLayer::LayerEditedMessage& message); |
1201 | 195 |
408 | 196 public: |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1038
diff
changeset
|
197 RadiographyScene(); |
408 | 198 |
199 virtual ~RadiographyScene(); | |
200 | |
876 | 201 virtual size_t GetApproximateMemoryUsage() const; |
202 | |
408 | 203 bool GetWindowing(float& center, |
204 float& width) const; | |
205 | |
206 void GetWindowingWithDefault(float& center, | |
207 float& width) const; | |
208 | |
730
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
209 virtual void SetWindowing(float center, |
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
210 float width); |
408 | 211 |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
212 RadiographyPhotometricDisplayMode GetPreferredPhotomotricDisplayMode() const; |
432
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
430
diff
changeset
|
213 |
1190 | 214 RadiographyLayer& LoadText(const std::string& utf8, |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
215 const std::string& font, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
216 unsigned int fontSize, |
1190 | 217 uint8_t foreground, |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
218 RadiographyLayer::Geometry* geometry, |
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
219 bool isCenterGeometry); |
1201 | 220 |
221 RadiographyLayer& UpdateText(size_t layerIndex, | |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
222 const std::string& font, |
1201 | 223 const std::string& utf8, |
224 unsigned int fontSize, | |
225 uint8_t foreground); | |
226 | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
227 RadiographyLayer& LoadTestBlock(unsigned int width, |
430 | 228 unsigned int height, |
229 RadiographyLayer::Geometry* geometry); | |
230 | |
488 | 231 RadiographyLayer& LoadMask(const std::vector<Orthanc::ImageProcessing::ImagePoint>& corners, |
475
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
232 const RadiographyDicomLayer& dicomLayer, |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
233 float foreground, |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
234 RadiographyLayer::Geometry* geometry); |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
235 |
430 | 236 RadiographyLayer& LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, // takes ownership |
237 RadiographyLayer::Geometry* geometry); | |
238 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
239 virtual RadiographyLayer& LoadDicomImage(Orthanc::ImageAccessor* dicomImage, // takes ownership |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
240 const std::string& instance, |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
241 unsigned int frame, |
714
d2c0e347ddc2
deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
658
diff
changeset
|
242 Deprecated::DicomFrameConverter* converter, // takes ownership |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
243 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode, |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
244 RadiographyLayer::Geometry* geometry); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
245 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
246 virtual RadiographyLayer& LoadDicomFrame(Deprecated::OrthancApiClient& orthanc, |
438 | 247 const std::string& instance, |
248 unsigned int frame, | |
249 bool httpCompression, | |
250 RadiographyLayer::Geometry* geometry); // pass NULL if you want default geometry | |
408 | 251 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
252 RadiographyLayer& LoadDicomWebFrame(Deprecated::IWebService& web); |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
253 |
425 | 254 void RemoveLayer(size_t layerIndex); |
255 | |
1201 | 256 RadiographyLayer& GetLayer(size_t layerIndex); |
257 | |
430 | 258 const RadiographyLayer& GetLayer(size_t layerIndex) const; |
425 | 259 |
492 | 260 template <typename TypeLayer> |
1201 | 261 TypeLayer* GetTypedLayer(size_t indexOfType = 0) |
492 | 262 { |
263 std::vector<size_t> layerIndexes; | |
264 GetLayersIndexes(layerIndexes); | |
265 | |
266 size_t count = 0; | |
267 | |
268 for (size_t i = 0; i < layerIndexes.size(); ++i) | |
269 { | |
270 TypeLayer* typedLayer = dynamic_cast<TypeLayer*>(layers_[layerIndexes[i]]); | |
271 if (typedLayer != NULL) | |
272 { | |
1201 | 273 if (count == indexOfType) |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
274 { |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
275 return typedLayer; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
276 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
277 count++; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
278 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
279 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
280 |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
281 return NULL; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
282 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
283 |
430 | 284 void GetLayersIndexes(std::vector<size_t>& output) const; |
425 | 285 |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
286 virtual Extent2D GetSceneExtent(bool minimal) const; |
408 | 287 |
1038 | 288 virtual void Render(Orthanc::ImageAccessor& buffer, |
289 const AffineTransform2D& viewTransform, | |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
290 ImageInterpolation interpolation, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
291 bool applyWindowing) const; |
408 | 292 |
293 bool LookupLayer(size_t& index /* out */, | |
294 double x, | |
295 double y) const; | |
296 | |
297 void DrawBorder(CairoContext& context, | |
298 unsigned int layer, | |
299 double zoom); | |
300 | |
301 void GetRange(float& minValue, | |
302 float& maxValue) const; | |
303 | |
1373
e0cdf8688d56
wip: from RadiographyScene to Scene2D
Alain Mazy <alain@mazy.be>
parents:
1330
diff
changeset
|
304 void ExportToScene2D(Scene2D& output) const; |
e0cdf8688d56
wip: from RadiographyScene to Scene2D
Alain Mazy <alain@mazy.be>
parents:
1330
diff
changeset
|
305 |
408 | 306 // Export using PAM is faster than using PNG, but requires Orthanc |
307 // core >= 1.4.3 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
308 void ExportDicom(Deprecated::OrthancApiClient& orthanc, |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
309 const Orthanc::DicomMap& dicom, |
426 | 310 const std::string& parentOrthancId, |
408 | 311 double pixelSpacingX, |
312 double pixelSpacingY, | |
313 bool invert, | |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
314 bool autoCrop, |
408 | 315 ImageInterpolation interpolation, |
316 bool usePam); | |
426 | 317 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
318 void ExportDicom(Deprecated::OrthancApiClient& orthanc, |
483 | 319 const Json::Value& dicomTags, |
320 const std::string& parentOrthancId, | |
321 double pixelSpacingX, | |
322 double pixelSpacingY, | |
323 bool invert, | |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
324 bool autoCrop, |
483 | 325 ImageInterpolation interpolation, |
326 bool usePam); | |
327 | |
484
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
328 void ExportToCreateDicomRequest(Json::Value& createDicomRequestContent, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
329 const Json::Value& dicomTags, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
330 const std::string& parentOrthancId, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
331 double pixelSpacingX, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
332 double pixelSpacingY, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
333 bool invert, |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
334 bool autoCrop, |
484
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
335 ImageInterpolation interpolation, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
336 bool usePam); |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
337 |
587 | 338 Orthanc::Image* ExportToCreateDicomRequestAndImage(Json::Value& createDicomRequestContent, |
339 const Json::Value& dicomTags, | |
340 const std::string& parentOrthancId, | |
341 double pixelSpacingX, | |
342 double pixelSpacingY, | |
343 bool invert, | |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
344 bool autoCrop, |
587 | 345 ImageInterpolation interpolation); |
346 | |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
347 Orthanc::Image* ExportToImage(double pixelSpacingX, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
348 double pixelSpacingY, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
349 ImageInterpolation interpolation, |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
350 bool autoCrop, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
351 bool applyWindowing) |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
352 { |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
353 return ExportToImage(pixelSpacingX, pixelSpacingY, interpolation, false, 0, autoCrop, applyWindowing); |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
354 } |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
355 |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
356 Orthanc::Image* ExportToImage(double pixelSpacingX, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
357 double pixelSpacingY, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
358 ImageInterpolation interpolation, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
359 bool invert, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
360 int64_t maxValue /* for inversion */, |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
361 bool autoCrop, |
1202 | 362 bool applyWindowing); |
363 | |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
364 void ExtractLayerFromRenderedScene(Orthanc::ImageAccessor& layer, |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
365 const Orthanc::ImageAccessor& renderedScene, |
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
366 size_t layerIndex, |
1330
a72c2c9af49a
minimal option for GetSceneExtent, especially for masks
Alain Mazy <alain@mazy.be>
parents:
1321
diff
changeset
|
367 bool isCropped, |
1259
69177b10e2b9
various fixes for RadiographyScene: support text layers outside the dicom layer, fix background in this case + extract dicom from rendered scene
Alain Mazy <alain@mazy.be>
parents:
1257
diff
changeset
|
368 ImageInterpolation interpolation); |
408 | 369 }; |
370 } |