Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/OrientedBoundingBox.cpp @ 735:c3bbb130abc4
removing dependencies in ImageBuffer3D
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 21 May 2019 16:15:06 +0200 |
parents | 7719eb852dd5 |
children |
comparison
equal
deleted
inserted
replaced
734:be3671662eec | 735:c3bbb130abc4 |
---|---|
20 | 20 |
21 | 21 |
22 #include "OrientedBoundingBox.h" | 22 #include "OrientedBoundingBox.h" |
23 | 23 |
24 #include "GeometryToolbox.h" | 24 #include "GeometryToolbox.h" |
25 #include "../Volumes/ImageBuffer3D.h" | |
25 | 26 |
26 #include <Core/OrthancException.h> | 27 #include <Core/OrthancException.h> |
27 | 28 |
28 #include <cassert> | 29 #include <cassert> |
29 | 30 |
30 namespace OrthancStone | 31 namespace OrthancStone |
31 { | 32 { |
32 OrientedBoundingBox::OrientedBoundingBox(const ImageBuffer3D& image) | 33 OrientedBoundingBox::OrientedBoundingBox(const VolumeImageGeometry& geometry) |
33 { | 34 { |
34 unsigned int n = image.GetDepth(); | 35 unsigned int n = geometry.GetDepth(); |
35 if (n < 1) | 36 if (n < 1) |
36 { | 37 { |
37 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize); | 38 throw Orthanc::OrthancException(Orthanc::ErrorCode_IncompatibleImageSize); |
38 } | 39 } |
39 | 40 |
40 const CoordinateSystem3D& geometry = image.GetGeometry().GetAxialGeometry(); | 41 Vector dim = geometry.GetVoxelDimensions(VolumeProjection_Axial); |
41 Vector dim = image.GetGeometry().GetVoxelDimensions(VolumeProjection_Axial); | 42 |
42 | 43 u_ = geometry.GetAxialGeometry().GetAxisX(); |
43 u_ = geometry.GetAxisX(); | 44 v_ = geometry.GetAxialGeometry().GetAxisY(); |
44 v_ = geometry.GetAxisY(); | 45 w_ = geometry.GetAxialGeometry().GetNormal(); |
45 w_ = geometry.GetNormal(); | 46 |
46 | 47 hu_ = static_cast<double>(geometry.GetWidth() * dim[0] / 2.0); |
47 hu_ = static_cast<double>(image.GetWidth() * dim[0] / 2.0); | 48 hv_ = static_cast<double>(geometry.GetHeight() * dim[1] / 2.0); |
48 hv_ = static_cast<double>(image.GetHeight() * dim[1] / 2.0); | 49 hw_ = static_cast<double>(geometry.GetDepth() * dim[2] / 2.0); |
49 hw_ = static_cast<double>(image.GetDepth() * dim[2] / 2.0); | |
50 | 50 |
51 c_ = (geometry.GetOrigin() + | 51 c_ = (geometry.GetAxialGeometry().GetOrigin() + |
52 (hu_ - dim[0] / 2.0) * u_ + | 52 (hu_ - dim[0] / 2.0) * u_ + |
53 (hv_ - dim[1] / 2.0) * v_ + | 53 (hv_ - dim[1] / 2.0) * v_ + |
54 (hw_ - dim[2] / 2.0) * w_); | 54 (hw_ - dim[2] / 2.0) * w_); |
55 } | 55 } |
56 | 56 |