Mercurial > hg > orthanc-stone
comparison Framework/Volumes/VolumeImageGeometry.h @ 860:238693c3bc51 am-dev
merge default -> am-dev
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 24 Jun 2019 14:35:00 +0200 |
parents | ffec76a5f7eb |
children | 32eaf4929b08 |
comparison
equal
deleted
inserted
replaced
856:a6e17a5a39e7 | 860:238693c3bc51 |
---|---|
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 /** | |
119 Being given a cutting plane, this method will determine if it is an | |
120 axial, sagittal or coronal cut and returns | |
121 the slice number corresponding to this cut. | |
122 | |
123 If the cutting plane is not parallel to the tree x = 0, y = 0 or z = 0 | |
124 planes, it is considered as arbitrary and the method returns false. | |
125 Otherwise, it returns true. | |
126 */ | |
127 bool DetectSlice(VolumeProjection& projection, | |
128 unsigned int& slice, | |
129 const CoordinateSystem3D& plane) const; | |
130 | |
131 CoordinateSystem3D GetProjectionSlice(VolumeProjection projection, | |
132 unsigned int z) const; | |
133 }; | |
134 } |