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