annotate Framework/Radiography/RadiographyScene.h @ 732:c35e98d22764

move Deprecated classes to a separate folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 May 2019 14:27:35 +0200
parents 4f2416d519b4
children 717eabfa749a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 417
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
aede9b042cb7 now using ImageProcessing::FillPolygon
am@osimis.io
parents: 484
diff changeset
29 #include "Core/Images/ImageProcessing.h"
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OrthancStone
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 class RadiographyScene :
426
660fe6f6bf4a split Export in 2
am@osimis.io
parents: 425
diff changeset
36 public IObserver,
660fe6f6bf4a split Export in 2
am@osimis.io
parents: 425
diff changeset
37 public IObservable
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
44 private:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
45 RadiographyLayer& layer_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
46
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
47 public:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
48 GeometryChangedMessage(const RadiographyScene& origin,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
49 RadiographyLayer& layer) :
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
50 OriginMessage(origin),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
51 layer_(layer)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
52 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
53 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
54
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
55 RadiographyLayer& GetLayer() const
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
56 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
57 return layer_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
58 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
59 };
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
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
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
65 private:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
66 RadiographyLayer& layer_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
67
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
68 public:
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
69 ContentChangedMessage(const RadiographyScene& origin,
438
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
70 RadiographyLayer& layer) :
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
71 OriginMessage(origin),
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
72 layer_(layer)
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
73 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
74 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
75
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
76 RadiographyLayer& GetLayer() const
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
77 {
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
78 return layer_;
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
79 }
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
80 };
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
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
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
103
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 587
diff changeset
104 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, WindowingChangedMessage, RadiographyScene);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
643
f0008c55e5f7 getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 587
diff changeset
106
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 class LayerAccessor : public boost::noncopyable
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 {
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 private:
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 RadiographyScene& scene_;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 size_t index_;
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
112 RadiographyLayer* layer_;
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 public:
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 LayerAccessor(RadiographyScene& scene,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 size_t index);
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 LayerAccessor(RadiographyScene& scene,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 double x,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 double y);
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 void Invalidate()
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 layer_ = NULL;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 }
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 bool IsValid() const
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 {
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 return layer_ != NULL;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 }
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 RadiographyScene& GetScene() const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 size_t GetIndex() const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
136 RadiographyLayer& GetLayer() const;
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 };
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
452
9a8fe40acfff improved inheritence of RadiographyScene
Alain Mazy <alain@mazy.be>
parents: 440
diff changeset
140 protected:
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
141 typedef std::map<size_t, RadiographyLayer*> Layers;
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
143 size_t countLayers_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
144 bool hasWindowing_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
145 float windowingCenter_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
146 float windowingWidth_;
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
147 Layers layers_;
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
438
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
149 protected:
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
150 RadiographyLayer& RegisterLayer(RadiographyLayer* layer);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
152 void OnTagsReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
154 virtual void OnFrameReceived(const Deprecated::OrthancApiClient::BinaryResponseReadyMessage& message);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
156 void OnDicomExported(const Deprecated::OrthancApiClient::JsonResponseReadyMessage& message);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
158 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
159
503
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
160 void OnLayerEdited(const RadiographyLayer::LayerEditedMessage& message);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 public:
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
162 RadiographyScene(MessageBroker& broker);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 virtual ~RadiographyScene();
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 bool GetWindowing(float& center,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 float& width) const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 void GetWindowingWithDefault(float& center,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 float& width) const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 void SetWindowing(float center,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 float width);
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
432
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
175 PhotometricDisplayMode GetPreferredPhotomotricDisplayMode() const;
4eb96c6b4e96 improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents: 430
diff changeset
176
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
177 RadiographyLayer& LoadText(const Orthanc::Font& font,
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
178 const std::string& utf8,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
179 RadiographyLayer::Geometry* geometry);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
410
6decc0ba9da5 rename RadiographyScene::Layer as RadiographyLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
181 RadiographyLayer& LoadTestBlock(unsigned int width,
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
182 unsigned int height,
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
183 RadiographyLayer::Geometry* geometry);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
184
488
aede9b042cb7 now using ImageProcessing::FillPolygon
am@osimis.io
parents: 484
diff changeset
185 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
186 const RadiographyDicomLayer& dicomLayer,
3c28542229a3 added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents: 452
diff changeset
187 float foreground,
3c28542229a3 added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents: 452
diff changeset
188 RadiographyLayer::Geometry* geometry);
3c28542229a3 added a mask layer in the RadiographyWidget (to be cleaned)
am@osimis.io
parents: 452
diff changeset
189
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
190 RadiographyLayer& LoadAlphaBitmap(Orthanc::ImageAccessor* bitmap, // takes ownership
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
191 RadiographyLayer::Geometry* geometry);
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
192
553
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 503
diff changeset
193 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
194 const std::string& instance,
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 503
diff changeset
195 unsigned int frame,
714
d2c0e347ddc2 deprecating DicomFrameConverter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 658
diff changeset
196 Deprecated::DicomFrameConverter* converter, // takes ownership
553
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 503
diff changeset
197 PhotometricDisplayMode preferredPhotometricDisplayMode,
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 503
diff changeset
198 RadiographyLayer::Geometry* geometry);
92305ee35b1c web-worker consequences: give access to lower level data
Alain Mazy <alain@mazy.be>
parents: 503
diff changeset
199
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
200 virtual RadiographyLayer& LoadDicomFrame(Deprecated::OrthancApiClient& orthanc,
438
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
201 const std::string& instance,
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
202 unsigned int frame,
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
203 bool httpCompression,
237160cbb44f allow derivation of RadiographyScene
am@osimis.io
parents: 432
diff changeset
204 RadiographyLayer::Geometry* geometry); // pass NULL if you want default geometry
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
206 RadiographyLayer& LoadDicomWebFrame(Deprecated::IWebService& web);
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
207
425
087237703d63 added layer accessors
am@osimis.io
parents: 417
diff changeset
208 void RemoveLayer(size_t layerIndex);
087237703d63 added layer accessors
am@osimis.io
parents: 417
diff changeset
209
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
210 const RadiographyLayer& GetLayer(size_t layerIndex) const;
425
087237703d63 added layer accessors
am@osimis.io
parents: 417
diff changeset
211
492
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
212 template <typename TypeLayer>
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
213 TypeLayer* GetLayer(size_t index = 0)
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
214 {
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
215 std::vector<size_t> layerIndexes;
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
216 GetLayersIndexes(layerIndexes);
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
217
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
218 size_t count = 0;
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
219
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
220 for (size_t i = 0; i < layerIndexes.size(); ++i)
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
221 {
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
222 TypeLayer* typedLayer = dynamic_cast<TypeLayer*>(layers_[layerIndexes[i]]);
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
223 if (typedLayer != NULL)
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
224 {
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
225 if (count == index)
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
226 {
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
227 return typedLayer;
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
228 }
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
229 count++;
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
230 }
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
231 }
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
232
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
233 return NULL;
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
234 }
64d90190a08c template GetLayer
Alain Mazy <alain@mazy.be>
parents: 488
diff changeset
235
503
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
236 template <typename TypeLayer>
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
237 const TypeLayer* GetLayer(size_t index = 0) const
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
238 {
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
239 std::vector<size_t> layerIndexes;
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
240 GetLayersIndexes(layerIndexes);
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
241
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
242 size_t count = 0;
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
243
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
244 for (size_t i = 0; i < layerIndexes.size(); ++i)
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
245 {
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
246 const TypeLayer* typedLayer = dynamic_cast<const TypeLayer*>(layers_.at(layerIndexes[i]));
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
247 if (typedLayer != NULL)
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
248 {
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
249 if (count == index)
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
250 {
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
251 return typedLayer;
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
252 }
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
253 count++;
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
254 }
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
255 }
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
256
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
257 return NULL;
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
258 }
77e0eb83ff63 layers are now Observable and emitting LayerEdited messages
amazy
parents: 492
diff changeset
259
430
b85f635f1eb5 added serialization for RadiographyScene
am@osimis.io
parents: 427
diff changeset
260 void GetLayersIndexes(std::vector<size_t>& output) const;
425
087237703d63 added layer accessors
am@osimis.io
parents: 417
diff changeset
261
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 Extent2D GetSceneExtent() const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 void Render(Orthanc::ImageAccessor& buffer,
409
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 408
diff changeset
265 const AffineTransform2D& viewTransform,
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 ImageInterpolation interpolation) const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 bool LookupLayer(size_t& index /* out */,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 double x,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 double y) const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 void DrawBorder(CairoContext& context,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 unsigned int layer,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 double zoom);
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 void GetRange(float& minValue,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 float& maxValue) const;
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 // Export using PAM is faster than using PNG, but requires Orthanc
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 // core >= 1.4.3
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
281 void ExportDicom(Deprecated::OrthancApiClient& orthanc,
417
aee3d7941c9b preparing to load images using DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 410
diff changeset
282 const Orthanc::DicomMap& dicom,
426
660fe6f6bf4a split Export in 2
am@osimis.io
parents: 425
diff changeset
283 const std::string& parentOrthancId,
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 double pixelSpacingX,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 double pixelSpacingY,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 bool invert,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 ImageInterpolation interpolation,
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 bool usePam);
426
660fe6f6bf4a split Export in 2
am@osimis.io
parents: 425
diff changeset
289
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 714
diff changeset
290 void ExportDicom(Deprecated::OrthancApiClient& orthanc,
483
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
291 const Json::Value& dicomTags,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
292 const std::string& parentOrthancId,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
293 double pixelSpacingX,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
294 double pixelSpacingY,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
295 bool invert,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
296 ImageInterpolation interpolation,
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
297 bool usePam);
29fc066b6f65 Export now accepts Json::Value
am@osimis.io
parents: 481
diff changeset
298
484
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
299 void ExportToCreateDicomRequest(Json::Value& createDicomRequestContent,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
300 const Json::Value& dicomTags,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
301 const std::string& parentOrthancId,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
302 double pixelSpacingX,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
303 double pixelSpacingY,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
304 bool invert,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
305 ImageInterpolation interpolation,
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
306 bool usePam);
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
307
587
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
308 Orthanc::Image* ExportToCreateDicomRequestAndImage(Json::Value& createDicomRequestContent,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
309 const Json::Value& dicomTags,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
310 const std::string& parentOrthancId,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
311 double pixelSpacingX,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
312 double pixelSpacingY,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
313 bool invert,
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
314 ImageInterpolation interpolation);
848170ca4351 more export functions
Alain Mazy <alain@mazy.be>
parents: 553
diff changeset
315
481
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
316 Orthanc::Image* ExportToImage(double pixelSpacingX,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
317 double pixelSpacingY,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
318 ImageInterpolation interpolation)
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
319 {
484
7bf001b9d244 re-added ExportToCreateDicomRequest
Alain Mazy <alain@mazy.be>
parents: 483
diff changeset
320 return ExportToImage(pixelSpacingX, pixelSpacingY, interpolation, false, 0);
481
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
321 }
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
322
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
323 Orthanc::Image* ExportToImage(double pixelSpacingX,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
324 double pixelSpacingY,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
325 ImageInterpolation interpolation,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
326 bool invert,
159a465e27bd reworked RadiographyScene export to export to an Orthanc::Image too
am@osimis.io
parents: 475
diff changeset
327 int64_t maxValue /* for inversion */);
408
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 };
6834c236b36d reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 }