Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyScene.h @ 1257:6af941a68472
RadiographyScene: virtual methods to use in derived class
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 14 Jan 2020 12:05:01 +0100 |
parents | 9ee6b28f53e8 |
children | 69177b10e2b9 |
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 | |
439 | 5 * Copyright (C) 2017-2019 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" |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
25 #include "../Deprecated/Toolbox/DicomFrameConverter.h" |
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
26 #include "../Deprecated/Toolbox/OrthancApiClient.h" |
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
27 #include "../StoneEnumerations.h" |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
28 #include "Core/Images/Image.h" |
488 | 29 #include "Core/Images/ImageProcessing.h" |
408 | 30 |
31 namespace OrthancStone | |
32 { | |
475
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
33 class RadiographyDicomLayer; |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
34 |
408 | 35 class RadiographyScene : |
426 | 36 public IObserver, |
37 public IObservable | |
408 | 38 { |
39 public: | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
40 class GeometryChangedMessage : public OriginMessage<RadiographyScene> |
430 | 41 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
42 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
43 |
430 | 44 private: |
45 RadiographyLayer& layer_; | |
46 | |
47 public: | |
48 GeometryChangedMessage(const RadiographyScene& origin, | |
49 RadiographyLayer& layer) : | |
50 OriginMessage(origin), | |
51 layer_(layer) | |
52 { | |
53 } | |
54 | |
55 RadiographyLayer& GetLayer() const | |
56 { | |
57 return layer_; | |
58 } | |
59 }; | |
60 | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
61 class ContentChangedMessage : public OriginMessage<RadiographyScene> |
430 | 62 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
63 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
64 |
430 | 65 private: |
66 RadiographyLayer& layer_; | |
67 | |
68 public: | |
69 ContentChangedMessage(const RadiographyScene& origin, | |
438 | 70 RadiographyLayer& layer) : |
430 | 71 OriginMessage(origin), |
72 layer_(layer) | |
73 { | |
74 } | |
75 | |
76 RadiographyLayer& GetLayer() const | |
77 { | |
78 return layer_; | |
79 } | |
80 }; | |
81 | |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
82 class LayerEditedMessage : public OriginMessage<RadiographyScene> |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
83 { |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
84 ORTHANC_STONE_MESSAGE(__FILE__, __LINE__); |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
85 |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
86 private: |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
87 const RadiographyLayer& layer_; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
88 |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
89 public: |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
90 LayerEditedMessage(const RadiographyScene& origin, |
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 OriginMessage(origin), |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
93 layer_(layer) |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
94 { |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
95 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
96 |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
97 const RadiographyLayer& GetLayer() const |
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 return layer_; |
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 }; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
102 |
1131
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
103 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
|
104 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
105 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
|
106 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
107 private: |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
108 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
|
109 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
110 public: |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
111 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
|
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 OriginMessage(origin), |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
114 layerIndex_(layerIndex) |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
115 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
116 } |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
117 |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
118 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
|
119 { |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
120 return layerIndex_; |
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 }; |
4663f158c748
RadiographyWidget is now notified when a layer is removed from the scene
Alain Mazy <alain@mazy.be>
parents:
1118
diff
changeset
|
123 |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
124 |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
125 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, WindowingChangedMessage, RadiographyScene); |
408 | 126 |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
587
diff
changeset
|
127 |
408 | 128 class LayerAccessor : public boost::noncopyable |
129 { | |
130 private: | |
131 RadiographyScene& scene_; | |
132 size_t index_; | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
133 RadiographyLayer* layer_; |
408 | 134 |
135 public: | |
136 LayerAccessor(RadiographyScene& scene, | |
137 size_t index); | |
138 | |
139 LayerAccessor(RadiographyScene& scene, | |
140 double x, | |
141 double y); | |
142 | |
143 void Invalidate() | |
144 { | |
145 layer_ = NULL; | |
146 } | |
147 | |
148 bool IsValid() const | |
149 { | |
150 return layer_ != NULL; | |
151 } | |
152 | |
153 RadiographyScene& GetScene() const; | |
154 | |
155 size_t GetIndex() const; | |
156 | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
157 RadiographyLayer& GetLayer() const; |
408 | 158 }; |
159 | |
160 | |
452
9a8fe40acfff
improved inheritence of RadiographyScene
Alain Mazy <alain@mazy.be>
parents:
440
diff
changeset
|
161 protected: |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
162 typedef std::map<size_t, RadiographyLayer*> Layers; |
408 | 163 |
1199
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
1196
diff
changeset
|
164 size_t nextLayerIndex_; |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
165 bool hasWindowing_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
166 float windowingCenter_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
167 float windowingWidth_; |
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
168 Layers layers_; |
408 | 169 |
438 | 170 protected: |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
171 RadiographyLayer& RegisterLayer(RadiographyLayer* layer); |
408 | 172 |
1257
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
173 virtual void _RegisterLayer(RadiographyLayer* layer); |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
174 |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
175 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
|
176 { |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
177 layer->SetIndex(index); |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
178 } |
6af941a68472
RadiographyScene: virtual methods to use in derived class
Alain Mazy <alain@mazy.be>
parents:
1220
diff
changeset
|
179 |
1118
35e798b16b65
RadiographyDicomLayer: allow replacing low res image by high res image
Alain Mazy <alain@mazy.be>
parents:
1038
diff
changeset
|
180 virtual void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); |
408 | 181 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
182 virtual void OnFrameReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message); |
408 | 183 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
184 void OnDicomExported(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message); |
408 | 185 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
186 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
|
187 |
730
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
188 virtual void OnLayerEdited(const RadiographyLayer::LayerEditedMessage& message); |
1201 | 189 |
408 | 190 public: |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
191 RadiographyScene(MessageBroker& broker); |
408 | 192 |
193 virtual ~RadiographyScene(); | |
194 | |
876 | 195 virtual size_t GetApproximateMemoryUsage() const; |
196 | |
408 | 197 bool GetWindowing(float& center, |
198 float& width) const; | |
199 | |
200 void GetWindowingWithDefault(float& center, | |
201 float& width) const; | |
202 | |
730
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
203 virtual void SetWindowing(float center, |
fe938bddb932
fix after namespace rename to Deprecated
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
204 float width); |
408 | 205 |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
206 RadiographyPhotometricDisplayMode GetPreferredPhotomotricDisplayMode() const; |
432
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
430
diff
changeset
|
207 |
1190 | 208 RadiographyLayer& LoadText(const std::string& utf8, |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
209 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
|
210 unsigned int fontSize, |
1190 | 211 uint8_t foreground, |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
212 RadiographyLayer::Geometry* geometry, |
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
213 bool isCenterGeometry); |
1201 | 214 |
215 RadiographyLayer& UpdateText(size_t layerIndex, | |
1220
9ee6b28f53e8
RadiographyTextLayer: support multiple fonts
Alain Mazy <alain@mazy.be>
parents:
1202
diff
changeset
|
216 const std::string& font, |
1201 | 217 const std::string& utf8, |
218 unsigned int fontSize, | |
219 uint8_t foreground); | |
220 | |
410
6decc0ba9da5
rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
221 RadiographyLayer& LoadTestBlock(unsigned int width, |
430 | 222 unsigned int height, |
223 RadiographyLayer::Geometry* geometry); | |
224 | |
488 | 225 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
|
226 const RadiographyDicomLayer& dicomLayer, |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
227 float foreground, |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
228 RadiographyLayer::Geometry* geometry); |
3c28542229a3
added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents:
452
diff
changeset
|
229 |
430 | 230 RadiographyLayer& LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, // takes ownership |
231 RadiographyLayer::Geometry* geometry); | |
232 | |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
233 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
|
234 const std::string& instance, |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
235 unsigned int frame, |
714
d2c0e347ddc2
deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
658
diff
changeset
|
236 Deprecated::DicomFrameConverter* converter, // takes ownership |
739
be9c1530d40a
deprecating enum SliceImageQuality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
733
diff
changeset
|
237 RadiographyPhotometricDisplayMode preferredPhotometricDisplayMode, |
553
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
238 RadiographyLayer::Geometry* geometry); |
92305ee35b1c
web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
239 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
240 virtual RadiographyLayer& LoadDicomFrame(Deprecated::OrthancApiClient& orthanc, |
438 | 241 const std::string& instance, |
242 unsigned int frame, | |
243 bool httpCompression, | |
244 RadiographyLayer::Geometry* geometry); // pass NULL if you want default geometry | |
408 | 245 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
246 RadiographyLayer& LoadDicomWebFrame(Deprecated::IWebService& web); |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
247 |
425 | 248 void RemoveLayer(size_t layerIndex); |
249 | |
1201 | 250 RadiographyLayer& GetLayer(size_t layerIndex); |
251 | |
430 | 252 const RadiographyLayer& GetLayer(size_t layerIndex) const; |
425 | 253 |
492 | 254 template <typename TypeLayer> |
1201 | 255 TypeLayer* GetTypedLayer(size_t indexOfType = 0) |
492 | 256 { |
257 std::vector<size_t> layerIndexes; | |
258 GetLayersIndexes(layerIndexes); | |
259 | |
260 size_t count = 0; | |
261 | |
262 for (size_t i = 0; i < layerIndexes.size(); ++i) | |
263 { | |
264 TypeLayer* typedLayer = dynamic_cast<TypeLayer*>(layers_[layerIndexes[i]]); | |
265 if (typedLayer != NULL) | |
266 { | |
1201 | 267 if (count == indexOfType) |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
268 { |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
269 return typedLayer; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
270 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
271 count++; |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
272 } |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
492
diff
changeset
|
273 } |
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 NULL; |
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 |
430 | 278 void GetLayersIndexes(std::vector<size_t>& output) const; |
425 | 279 |
408 | 280 Extent2D GetSceneExtent() const; |
281 | |
1038 | 282 virtual void Render(Orthanc::ImageAccessor& buffer, |
283 const AffineTransform2D& viewTransform, | |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
284 ImageInterpolation interpolation, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
285 bool applyWindowing) const; |
408 | 286 |
287 bool LookupLayer(size_t& index /* out */, | |
288 double x, | |
289 double y) const; | |
290 | |
291 void DrawBorder(CairoContext& context, | |
292 unsigned int layer, | |
293 double zoom); | |
294 | |
295 void GetRange(float& minValue, | |
296 float& maxValue) const; | |
297 | |
298 // Export using PAM is faster than using PNG, but requires Orthanc | |
299 // core >= 1.4.3 | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
300 void ExportDicom(Deprecated::OrthancApiClient& orthanc, |
417
aee3d7941c9b
preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
410
diff
changeset
|
301 const Orthanc::DicomMap& dicom, |
426 | 302 const std::string& parentOrthancId, |
408 | 303 double pixelSpacingX, |
304 double pixelSpacingY, | |
305 bool invert, | |
306 ImageInterpolation interpolation, | |
307 bool usePam); | |
426 | 308 |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
714
diff
changeset
|
309 void ExportDicom(Deprecated::OrthancApiClient& orthanc, |
483 | 310 const Json::Value& dicomTags, |
311 const std::string& parentOrthancId, | |
312 double pixelSpacingX, | |
313 double pixelSpacingY, | |
314 bool invert, | |
315 ImageInterpolation interpolation, | |
316 bool usePam); | |
317 | |
484
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
318 void ExportToCreateDicomRequest(Json::Value& createDicomRequestContent, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
319 const Json::Value& dicomTags, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
320 const std::string& parentOrthancId, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
321 double pixelSpacingX, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
322 double pixelSpacingY, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
323 bool invert, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
324 ImageInterpolation interpolation, |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
325 bool usePam); |
7bf001b9d244
re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents:
483
diff
changeset
|
326 |
587 | 327 Orthanc::Image* ExportToCreateDicomRequestAndImage(Json::Value& createDicomRequestContent, |
328 const Json::Value& dicomTags, | |
329 const std::string& parentOrthancId, | |
330 double pixelSpacingX, | |
331 double pixelSpacingY, | |
332 bool invert, | |
333 ImageInterpolation interpolation); | |
334 | |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
335 Orthanc::Image* ExportToImage(double pixelSpacingX, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
336 double pixelSpacingY, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
337 ImageInterpolation interpolation, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
338 bool applyWindowing) |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
339 { |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
340 return ExportToImage(pixelSpacingX, pixelSpacingY, interpolation, false, 0, applyWindowing); |
481
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
341 } |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
342 |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
343 Orthanc::Image* ExportToImage(double pixelSpacingX, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
344 double pixelSpacingY, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
345 ImageInterpolation interpolation, |
159a465e27bd
reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents:
475
diff
changeset
|
346 bool invert, |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
1190
diff
changeset
|
347 int64_t maxValue /* for inversion */, |
1202 | 348 bool applyWindowing); |
349 | |
408 | 350 }; |
351 } |