Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/Slice.cpp @ 714:d2c0e347ddc2
deprecating DicomFrameConverter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 20 May 2019 16:26:34 +0200 |
parents | 2eeb5857eb43 |
children |
comparison
equal
deleted
inserted
replaced
713:e63c8b9b7b02 | 714:d2c0e347ddc2 |
---|---|
28 #include <Core/OrthancException.h> | 28 #include <Core/OrthancException.h> |
29 #include <Core/Toolbox.h> | 29 #include <Core/Toolbox.h> |
30 | 30 |
31 #include <boost/lexical_cast.hpp> | 31 #include <boost/lexical_cast.hpp> |
32 | 32 |
33 namespace OrthancStone | 33 namespace Deprecated |
34 { | 34 { |
35 static bool ParseDouble(double& target, | 35 static bool ParseDouble(double& target, |
36 const std::string& source) | 36 const std::string& source) |
37 { | 37 { |
38 try | 38 try |
116 { | 116 { |
117 LOG(ERROR) << "Invalid syntax"; | 117 LOG(ERROR) << "Invalid syntax"; |
118 return false; | 118 return false; |
119 } | 119 } |
120 | 120 |
121 if (!LinearAlgebra::IsCloseToZero(offset0)) | 121 if (!OrthancStone::LinearAlgebra::IsCloseToZero(offset0)) |
122 { | 122 { |
123 LOG(ERROR) << "Invalid syntax"; | 123 LOG(ERROR) << "Invalid syntax"; |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 geometry_ = CoordinateSystem3D(geometry_.GetOrigin() + z * geometry_.GetNormal(), | 127 geometry_ = OrthancStone::CoordinateSystem3D(geometry_.GetOrigin() + z * geometry_.GetNormal(), |
128 //+ 650 * geometry_.GetAxisX(), | 128 //+ 650 * geometry_.GetAxisX(), |
129 geometry_.GetAxisX(), | 129 geometry_.GetAxisX(), |
130 geometry_.GetAxisY()); | 130 geometry_.GetAxisY()); |
131 | 131 |
132 thickness_ = offset1 - offset0; | 132 thickness_ = offset1 - offset0; |
133 if (thickness_ < 0) | 133 if (thickness_ < 0) |
134 { | 134 { |
135 thickness_ = -thickness_; | 135 thickness_ = -thickness_; |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 converter_.ReadParameters(dataset); | 186 converter_.ReadParameters(dataset); |
187 | 187 |
188 GeometryToolbox::GetPixelSpacing(pixelSpacingX_, pixelSpacingY_, dataset); | 188 OrthancStone::GeometryToolbox::GetPixelSpacing(pixelSpacingX_, pixelSpacingY_, dataset); |
189 | 189 |
190 std::string position, orientation; | 190 std::string position, orientation; |
191 if (dataset.CopyToString(position, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT, false) && | 191 if (dataset.CopyToString(position, Orthanc::DICOM_TAG_IMAGE_POSITION_PATIENT, false) && |
192 dataset.CopyToString(orientation, Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT, false)) | 192 dataset.CopyToString(orientation, Orthanc::DICOM_TAG_IMAGE_ORIENTATION_PATIENT, false)) |
193 { | 193 { |
194 geometry_ = CoordinateSystem3D(position, orientation); | 194 geometry_ = OrthancStone::CoordinateSystem3D(position, orientation); |
195 | 195 |
196 bool ok = true; | 196 bool ok = true; |
197 | 197 |
198 switch (StringToSopClassUid(sopClassUid_)) | 198 switch (OrthancStone::StringToSopClassUid(sopClassUid_)) |
199 { | 199 { |
200 case SopClassUid_RTDose: | 200 case OrthancStone::SopClassUid_RTDose: |
201 type_ = Type_OrthancRawFrame; | 201 type_ = Type_OrthancRawFrame; |
202 ok = ComputeRTDoseGeometry(dataset, frame); | 202 ok = ComputeRTDoseGeometry(dataset, frame); |
203 break; | 203 break; |
204 | 204 |
205 default: | 205 default: |
241 | 241 |
242 return frame_; | 242 return frame_; |
243 } | 243 } |
244 | 244 |
245 | 245 |
246 const CoordinateSystem3D& Slice::GetGeometry() const | 246 const OrthancStone::CoordinateSystem3D& Slice::GetGeometry() const |
247 { | 247 { |
248 if (type_ == Type_Invalid) | 248 if (type_ == Type_Invalid) |
249 { | 249 { |
250 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | 250 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
251 } | 251 } |
318 | 318 |
319 return converter_; | 319 return converter_; |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 bool Slice::ContainsPlane(const CoordinateSystem3D& plane) const | 323 bool Slice::ContainsPlane(const OrthancStone::CoordinateSystem3D& plane) const |
324 { | 324 { |
325 if (type_ == Type_Invalid) | 325 if (type_ == Type_Invalid) |
326 { | 326 { |
327 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); | 327 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); |
328 } | 328 } |
329 | 329 |
330 bool opposite; | 330 bool opposite; |
331 return (GeometryToolbox::IsParallelOrOpposite(opposite, | 331 return (OrthancStone::GeometryToolbox::IsParallelOrOpposite(opposite, |
332 GetGeometry().GetNormal(), | 332 GetGeometry().GetNormal(), |
333 plane.GetNormal()) && | 333 plane.GetNormal()) && |
334 LinearAlgebra::IsNear(GetGeometry().ProjectAlongNormal(GetGeometry().GetOrigin()), | 334 OrthancStone::LinearAlgebra::IsNear(GetGeometry().ProjectAlongNormal(GetGeometry().GetOrigin()), |
335 GetGeometry().ProjectAlongNormal(plane.GetOrigin()), | 335 GetGeometry().ProjectAlongNormal(plane.GetOrigin()), |
336 thickness_ / 2.0)); | 336 thickness_ / 2.0)); |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 void Slice::GetExtent(std::vector<Vector>& points) const | 340 void Slice::GetExtent(std::vector<OrthancStone::Vector>& points) const |
341 { | 341 { |
342 double sx = GetPixelSpacingX(); | 342 double sx = GetPixelSpacingX(); |
343 double sy = GetPixelSpacingY(); | 343 double sy = GetPixelSpacingY(); |
344 double w = static_cast<double>(GetWidth()); | 344 double w = static_cast<double>(GetWidth()); |
345 double h = static_cast<double>(GetHeight()); | 345 double h = static_cast<double>(GetHeight()); |