comparison Framework/Volumes/VolumeImageGeometry.h @ 742:fa5febe0f0c2

moved OrientedBoundingBox in the Volumes folder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 May 2019 09:41:03 +0200
parents Framework/Toolbox/VolumeImageGeometry.h@93a8949a1ef7
children a6ba676a93e2
comparison
equal deleted inserted replaced
741:c1d6a566dfd3 742:fa5febe0f0c2
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
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
24 #include "../StoneEnumerations.h"
25 #include "../Toolbox/CoordinateSystem3D.h"
26
27 namespace OrthancStone
28 {
29 class VolumeImageGeometry
30 {
31 private:
32 unsigned int width_;
33 unsigned int height_;
34 unsigned int depth_;
35 CoordinateSystem3D axialGeometry_;
36 CoordinateSystem3D coronalGeometry_;
37 CoordinateSystem3D sagittalGeometry_;
38 Vector voxelDimensions_;
39 Matrix transform_;
40 Matrix transformInverse_;
41
42 void Invalidate();
43
44 public:
45 VolumeImageGeometry();
46
47 unsigned int GetWidth() const
48 {
49 return width_;
50 }
51
52 unsigned int GetHeight() const
53 {
54 return height_;
55 }
56
57 unsigned int GetDepth() const
58 {
59 return depth_;
60 }
61
62 const CoordinateSystem3D& GetAxialGeometry() const
63 {
64 return axialGeometry_;
65 }
66
67 const CoordinateSystem3D& GetCoronalGeometry() const
68 {
69 return coronalGeometry_;
70 }
71
72 const CoordinateSystem3D& GetSagittalGeometry() const
73 {
74 return sagittalGeometry_;
75 }
76
77 const CoordinateSystem3D& GetProjectionGeometry(VolumeProjection projection) const;
78
79 const Matrix& GetTransform() const
80 {
81 return transform_;
82 }
83
84 const Matrix& GetTransformInverse() const
85 {
86 return transformInverse_;
87 }
88
89 void SetSize(unsigned int width,
90 unsigned int height,
91 unsigned int depth);
92
93 // Set the geometry of the first axial slice (i.e. the one whose
94 // depth == 0)
95 void SetAxialGeometry(const CoordinateSystem3D& geometry);
96
97 void SetVoxelDimensions(double x,
98 double y,
99 double z);
100
101 Vector GetVoxelDimensions(VolumeProjection projection) const;
102
103 unsigned int GetProjectionWidth(VolumeProjection projection) const;
104
105 unsigned int GetProjectionHeight(VolumeProjection projection) const;
106
107 unsigned int GetProjectionDepth(VolumeProjection projection) const;
108
109 // Get the 3D position of a point in the volume, where x, y and z
110 // lie in the [0;1] range
111 Vector GetCoordinates(float x,
112 float y,
113 float z) const;
114
115 bool DetectProjection(VolumeProjection& projection,
116 const Vector& planeNormal) const;
117
118 bool DetectSlice(VolumeProjection& projection,
119 unsigned int& slice,
120 const CoordinateSystem3D& plane) const;
121 };
122 }