comparison OrthancStone/Sources/Volumes/VolumeImageGeometry.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Volumes/VolumeImageGeometry.h@2d8ab34c8c91
children 8563ea5d8ae4
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
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-2020 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 #include <iosfwd>
28
29 namespace OrthancStone
30 {
31 class VolumeImageGeometry
32 {
33 private:
34 unsigned int width_;
35 unsigned int height_;
36 unsigned int depth_;
37 CoordinateSystem3D axialGeometry_;
38 CoordinateSystem3D coronalGeometry_;
39 CoordinateSystem3D sagittalGeometry_;
40 Vector voxelDimensions_;
41 Matrix transform_;
42 Matrix transformInverse_;
43
44 void Invalidate();
45
46 friend std::ostream& operator<<(std::ostream& s, const VolumeImageGeometry& v);
47
48 public:
49 VolumeImageGeometry();
50
51 unsigned int GetWidth() const
52 {
53 return width_;
54 }
55
56 unsigned int GetHeight() const
57 {
58 return height_;
59 }
60
61 unsigned int GetDepth() const
62 {
63 return depth_;
64 }
65
66 const CoordinateSystem3D& GetAxialGeometry() const
67 {
68 return axialGeometry_;
69 }
70
71 const CoordinateSystem3D& GetCoronalGeometry() const
72 {
73 return coronalGeometry_;
74 }
75
76 const CoordinateSystem3D& GetSagittalGeometry() const
77 {
78 return sagittalGeometry_;
79 }
80
81 const CoordinateSystem3D& GetProjectionGeometry(VolumeProjection projection) const;
82
83 const Matrix& GetTransform() const
84 {
85 return transform_;
86 }
87
88 const Matrix& GetTransformInverse() const
89 {
90 return transformInverse_;
91 }
92
93 void SetSizeInVoxels(unsigned int width,
94 unsigned int height,
95 unsigned int depth);
96
97 // Set the geometry of the first axial slice (i.e. the one whose
98 // depth == 0)
99 void SetAxialGeometry(const CoordinateSystem3D& geometry);
100
101 void SetVoxelDimensions(double x,
102 double y,
103 double z);
104
105 Vector GetVoxelDimensions(VolumeProjection projection) const;
106
107 unsigned int GetProjectionWidth(VolumeProjection projection) const;
108
109 unsigned int GetProjectionHeight(VolumeProjection projection) const;
110
111 unsigned int GetProjectionDepth(VolumeProjection projection) const;
112
113 // Get the 3D position of a point in the volume, where x, y and z
114 // lie in the [0;1] range
115 Vector GetCoordinates(float x,
116 float y,
117 float z) const;
118
119 bool DetectProjection(VolumeProjection& projection,
120 const Vector& planeNormal) const;
121
122 /**
123 Being given a cutting plane, this method will determine if it is an
124 axial, sagittal or coronal cut and returns
125 the slice number corresponding to this cut.
126
127 If the cutting plane is not parallel to the three x = 0, y = 0 or z = 0
128 planes, it is considered as arbitrary and the method returns false.
129 Otherwise, it returns true.
130 */
131 bool DetectSlice(VolumeProjection& projection,
132 unsigned int& slice,
133 const CoordinateSystem3D& plane) const;
134
135 CoordinateSystem3D GetProjectionSlice(VolumeProjection projection,
136 unsigned int z) const;
137 };
138 }