Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyLayer.h @ 430:b85f635f1eb5 am-vsol-upgrade
added serialization for RadiographyScene
author | am@osimis.io |
---|---|
date | Thu, 29 Nov 2018 15:11:19 +0100 |
parents | 6decc0ba9da5 |
children | 4eb96c6b4e96 |
comparison
equal
deleted
inserted
replaced
429:c7fb700a7d12 | 430:b85f635f1eb5 |
---|---|
29 { | 29 { |
30 class RadiographyLayer : public boost::noncopyable | 30 class RadiographyLayer : public boost::noncopyable |
31 { | 31 { |
32 friend class RadiographyScene; | 32 friend class RadiographyScene; |
33 | 33 |
34 public: | |
35 class Geometry | |
36 { | |
37 bool hasCrop_; | |
38 unsigned int cropX_; | |
39 unsigned int cropY_; | |
40 unsigned int cropWidth_; | |
41 unsigned int cropHeight_; | |
42 double panX_; | |
43 double panY_; | |
44 double angle_; | |
45 bool resizeable_; | |
46 double pixelSpacingX_; | |
47 double pixelSpacingY_; | |
48 | |
49 public: | |
50 Geometry(); | |
51 | |
52 void ResetCrop() | |
53 { | |
54 hasCrop_ = false; | |
55 } | |
56 | |
57 void SetCrop(unsigned int x, | |
58 unsigned int y, | |
59 unsigned int width, | |
60 unsigned int height) | |
61 { | |
62 cropX_ = x; | |
63 cropY_ = y; | |
64 cropWidth_ = width; | |
65 cropHeight_ = height; | |
66 } | |
67 | |
68 bool HasCrop() const | |
69 { | |
70 return hasCrop_; | |
71 } | |
72 | |
73 void GetCrop(unsigned int& x, | |
74 unsigned int& y, | |
75 unsigned int& width, | |
76 unsigned int& height) const; | |
77 | |
78 void SetAngle(double angle) | |
79 { | |
80 angle_ = angle; | |
81 } | |
82 | |
83 double GetAngle() const | |
84 { | |
85 return angle_; | |
86 } | |
87 | |
88 void SetPan(double x, | |
89 double y) | |
90 { | |
91 panX_ = x; | |
92 panY_ = y; | |
93 } | |
94 | |
95 double GetPanX() const | |
96 { | |
97 return panX_; | |
98 } | |
99 | |
100 double GetPanY() const | |
101 { | |
102 return panY_; | |
103 } | |
104 | |
105 bool IsResizeable() const | |
106 { | |
107 return resizeable_; | |
108 } | |
109 | |
110 void SetResizeable(bool resizeable) | |
111 { | |
112 resizeable_ = resizeable; | |
113 } | |
114 | |
115 void SetPixelSpacing(double x, | |
116 double y) | |
117 { | |
118 pixelSpacingX_ = x; | |
119 pixelSpacingY_ = y; | |
120 } | |
121 | |
122 double GetPixelSpacingX() const | |
123 { | |
124 return pixelSpacingX_; | |
125 } | |
126 | |
127 double GetPixelSpacingY() const | |
128 { | |
129 return pixelSpacingY_; | |
130 } | |
131 | |
132 }; | |
133 | |
34 private: | 134 private: |
35 size_t index_; | 135 size_t index_; |
36 bool hasSize_; | 136 bool hasSize_; |
37 unsigned int width_; | 137 unsigned int width_; |
38 unsigned int height_; | 138 unsigned int height_; |
39 bool hasCrop_; | |
40 unsigned int cropX_; | |
41 unsigned int cropY_; | |
42 unsigned int cropWidth_; | |
43 unsigned int cropHeight_; | |
44 AffineTransform2D transform_; | 139 AffineTransform2D transform_; |
45 AffineTransform2D transformInverse_; | 140 AffineTransform2D transformInverse_; |
46 double pixelSpacingX_; | 141 Geometry geometry_; |
47 double pixelSpacingY_; | |
48 double panX_; | |
49 double panY_; | |
50 double angle_; | |
51 bool resizeable_; | |
52 | 142 |
53 protected: | 143 protected: |
54 const AffineTransform2D& GetTransform() const | 144 const AffineTransform2D& GetTransform() const |
55 { | 145 { |
56 return transform_; | 146 return transform_; |
92 size_t GetIndex() const | 182 size_t GetIndex() const |
93 { | 183 { |
94 return index_; | 184 return index_; |
95 } | 185 } |
96 | 186 |
97 void ResetCrop() | 187 const Geometry& GetGeometry() const |
98 { | 188 { |
99 hasCrop_ = false; | 189 return geometry_; |
100 } | 190 } |
191 | |
192 void SetGeometry(const Geometry& geometry); | |
193 | |
194 void ResetCrop(); | |
101 | 195 |
102 void SetCrop(unsigned int x, | 196 void SetCrop(unsigned int x, |
103 unsigned int y, | 197 unsigned int y, |
104 unsigned int width, | 198 unsigned int width, |
105 unsigned int height); | 199 unsigned int height); |
109 unsigned int& width, | 203 unsigned int& width, |
110 unsigned int& height) const; | 204 unsigned int& height) const; |
111 | 205 |
112 void SetAngle(double angle); | 206 void SetAngle(double angle); |
113 | 207 |
114 double GetAngle() const | 208 void SetPan(double x, |
115 { | 209 double y); |
116 return angle_; | 210 |
211 void SetResizeable(bool resizeable) | |
212 { | |
213 geometry_.SetResizeable(resizeable); | |
117 } | 214 } |
118 | 215 |
119 void SetSize(unsigned int width, | 216 void SetSize(unsigned int width, |
120 unsigned int height); | 217 unsigned int height); |
218 | |
219 bool HasSize() const | |
220 { | |
221 return hasSize_; | |
222 } | |
121 | 223 |
122 unsigned int GetWidth() const | 224 unsigned int GetWidth() const |
123 { | 225 { |
124 return width_; | 226 return width_; |
125 } | 227 } |
134 bool GetPixel(unsigned int& imageX, | 236 bool GetPixel(unsigned int& imageX, |
135 unsigned int& imageY, | 237 unsigned int& imageY, |
136 double sceneX, | 238 double sceneX, |
137 double sceneY) const; | 239 double sceneY) const; |
138 | 240 |
139 void SetPan(double x, | |
140 double y); | |
141 | |
142 void SetPixelSpacing(double x, | 241 void SetPixelSpacing(double x, |
143 double y); | 242 double y); |
144 | |
145 double GetPixelSpacingX() const | |
146 { | |
147 return pixelSpacingX_; | |
148 } | |
149 | |
150 double GetPixelSpacingY() const | |
151 { | |
152 return pixelSpacingY_; | |
153 } | |
154 | |
155 double GetPanX() const | |
156 { | |
157 return panX_; | |
158 } | |
159 | |
160 double GetPanY() const | |
161 { | |
162 return panY_; | |
163 } | |
164 | 243 |
165 void GetCenter(double& centerX, | 244 void GetCenter(double& centerX, |
166 double& centerY) const; | 245 double& centerY) const; |
167 | 246 |
168 void GetCorner(double& x /* out */, | 247 void GetCorner(double& x /* out */, |
173 double x, | 252 double x, |
174 double y, | 253 double y, |
175 double zoom, | 254 double zoom, |
176 double viewportDistance) const; | 255 double viewportDistance) const; |
177 | 256 |
178 bool IsResizeable() const | |
179 { | |
180 return resizeable_; | |
181 } | |
182 | |
183 void SetResizeable(bool resizeable) | |
184 { | |
185 resizeable_ = resizeable; | |
186 } | |
187 | |
188 virtual bool GetDefaultWindowing(float& center, | 257 virtual bool GetDefaultWindowing(float& center, |
189 float& width) const = 0; | 258 float& width) const = 0; |
190 | 259 |
191 virtual void Render(Orthanc::ImageAccessor& buffer, | 260 virtual void Render(Orthanc::ImageAccessor& buffer, |
192 const AffineTransform2D& viewTransform, | 261 const AffineTransform2D& viewTransform, |