My Project
orientation.hh
Go to the documentation of this file.
1 /* -*- mia-c++ -*-
2  *
3  * This file is part of MIA - a toolbox for medical image analysis
4  * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5  *
6  * MIA is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef __mia_3d_oriantation_hh
22 #define __mia_3d_oriantation_hh
23 
24 #include <ostream>
25 #include <istream>
26 
27 #include <mia/core/attributes.hh>
28 #include <mia/3d/quaternion.hh>
29 #include <mia/3d/matrix.hh>
30 #include <mia/core/vector.hh>
31 
33 
34 
41 
45  ior_xyz = 1,
47  ior_yxz = 3,
50  ior_xzy = 5,
52  ior_zxy = 7,
55  ior_yzx = 9,
57  ior_zyx = 11,
61  ior_axial = 1,
69  ior_unknown = 13,
70 };
71 
72 
74 
88 {
89 public:
91 
93 
95  const C3DFVector& origin,
96  const C3DFVector& scale,
97  const Quaternion& rot);
98 
100 
102 
104 
105  bool operator == (const C3DOrientationAndPosition& other) const;
106 
107  bool operator < (const C3DOrientationAndPosition& other) const;
108 
109 
110  void print(std::ostream& os) const;
111 
113 
115  const mia::C3DFVector& get_scale() const;
116 
119 
121  const mia::Quaternion& get_rotation()const;
122 
123 private:
124 
125  const C3DFMatrix& get_axis_switch_matrix() const;
126 
127  E3DImageOrientation m_axisorder;
128  C3DFVector m_origin;
129  C3DFVector m_scale;
130  Quaternion m_rotation;
131 
132  static const C3DFMatrix ms_order_XYZ;
133  static const C3DFMatrix ms_order_YXZ;
134  static const C3DFMatrix ms_order_XZY;
135  static const C3DFMatrix ms_order_ZYX;
136  static const C3DFMatrix ms_order_ZXY;
137  static const C3DFMatrix ms_order_YZX;
138 
139  static const C3DFMatrix ms_order_XYZ_F;
140  static const C3DFMatrix ms_order_YXZ_F;
141  static const C3DFMatrix ms_order_XZY_F;
142  static const C3DFMatrix ms_order_ZXY_F;
143  static const C3DFMatrix ms_order_ZYX_F;
144  static const C3DFMatrix ms_order_YZX_F;
145 
146 };
147 
148 
174 };
175 
176 
178 
186 EXPORT_3D std::ostream& operator << (std::ostream& os, E3DImageOrientation orient);
187 
195 EXPORT_3D std::istream& operator >> (std::istream& is, E3DImageOrientation& orient);
196 
197 
205 inline std::ostream& operator << (std::ostream& os, const C3DOrientationAndPosition& orient)
206 {
207  orient.print(os);
208  return os;
209 }
210 
218 EXPORT_3D std::istream& operator >> (std::istream& is, C3DOrientationAndPosition& orient);
219 
220 
228 EXPORT_3D std::ostream& operator << (std::ostream& os, E3DPatientPositioning pp);
229 
237 EXPORT_3D std::istream& operator >> (std::istream& is, E3DPatientPositioning& pp);
238 
244 extern template class EXPORT_3D TAttribute<E3DImageOrientation>;
245 
251 extern template class EXPORT_3D TTranslator<E3DImageOrientation>;
252 
253 
259 extern template class EXPORT_3D TAttribute<E3DPatientPositioning>;
260 
263 
266 
272 
273 template <>
275  static const int value = 3000;
276 };
277 
278 template <>
280  static const int value = 3001;
281 };
282 
283 template <>
285  static const int value = 3002;
286 };
287 
288 
289 
290 extern EXPORT_3D const char *IDPatientPosition;
291 
293 
294 #endif
bool operator<(const T2DVector< T > &a, const T2DVector< S > &b)
Definition: 2d/vector.hh:495
EXPORT_2D C2DFVectorfield & operator+=(C2DFVectorfield &a, const C2DFVectorfield &b)
T3DVector< float > C3DFVector
A float 3D Vector.
Definition: 3d/vector.hh:409
bool operator==(const CAttribute &a, const CAttribute &b)
Definition: attributes.hh:95
This class represents the oriantation and position of a 3D data set.
Definition: orientation.hh:88
void get_inverse_transform_parameters(CDoubleVector &params) const
const mia::Quaternion & get_rotation() const
C3DOrientationAndPosition(E3DImageOrientation axis, const C3DFVector &origin, const C3DFVector &scale, const Quaternion &rot)
E3DImageOrientation get_axis_orientation() const
C3DOrientationAndPosition(E3DImageOrientation axis)
const mia::C3DFVector & get_origin() const
const mia::C3DFVector & get_scale() const
void get_transform_parameters(CDoubleVector &params) const
void print(std::ostream &os) const
a class to implement a quaternion
Definition: quaternion.hh:44
Class of an attribute that holds data of type T.
Definition: attributes.hh:119
A wrapper around the c-array to provide an STL like interface for iterators.
Definition: core/vector.hh:78
A mapper from emums to string values. - usefull for names flags.
Definition: dictmap.hh:46
Generic string vs. attribute translator singleton.
Definition: attributes.hh:518
#define EXPORT_3D
Definition: defines3d.hh:45
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
EXPORT_3D std::istream & operator>>(std::istream &is, E3DImageOrientation &orient)
Stream operator to read orientation orient from stream is.
TTranslator< E3DImageOrientation > COrientationTranslator
translator for 3D image orientations to and from strings
Definition: orientation.hh:250
TTranslator< E3DPatientPositioning > CPatientPositionTranslator
translator for the patient position
Definition: orientation.hh:271
E3DPatientPositioning
Definition: orientation.hh:163
TAttribute< E3DImageOrientation > C3DImageOrientation
attribute for 3D image orientation
Definition: orientation.hh:243
E3DImageOrientation
Definition: orientation.hh:40
TAttribute< E3DPatientPositioning > CPatientPositionAttribute
attribute for the patient position
Definition: orientation.hh:258
EXPORT_3D std::ostream & operator<<(std::ostream &os, E3DImageOrientation orient)
Stream operator to write orientation orient to stream os.
@ ipp_hfdl
Definition: orientation.hh:168
@ ipp_ffp
Definition: orientation.hh:169
@ ipp_undefined
Definition: orientation.hh:164
@ ipp_ffs
Definition: orientation.hh:170
@ ipp_hfdr
Definition: orientation.hh:167
@ ipp_hfp
Definition: orientation.hh:165
@ ipp_ffdl
Definition: orientation.hh:172
@ ipp_ffdr
Definition: orientation.hh:171
@ ipp_lastindex
Definition: orientation.hh:173
@ ipp_hfs
Definition: orientation.hh:166
@ ior_yxz_flipped
Definition: orientation.hh:48
@ ior_xzy
Definition: orientation.hh:50
@ ior_saggital
Definition: orientation.hh:65
@ ior_coronal_flipped
Definition: orientation.hh:64
@ ior_axial
Definition: orientation.hh:61
@ ior_yzx
Definition: orientation.hh:55
@ ior_xzy_flipped
Definition: orientation.hh:51
@ ior_undefined
Definition: orientation.hh:42
@ ior_default
Definition: orientation.hh:43
@ ior_yxz
Definition: orientation.hh:47
@ ior_zxy_flipped
Definition: orientation.hh:53
@ ior_yzx_flipped
Definition: orientation.hh:56
@ ior_xyz_flipped
Definition: orientation.hh:46
@ ior_zxy
Definition: orientation.hh:52
@ ior_axial_flipped
Definition: orientation.hh:62
@ ior_xyz
Definition: orientation.hh:45
@ ior_coronal
Definition: orientation.hh:63
@ ior_unknown
Definition: orientation.hh:69
@ ior_zyx
Definition: orientation.hh:57
@ ior_zyx_flipped
Definition: orientation.hh:58
@ ior_saggital_flipped
Definition: orientation.hh:66
EXPORT_3D const char * IDPatientPosition
const TDictMap< E3DPatientPositioning > g_patient_position_map
TTranslator< C3DOrientationAndPosition > COrientationPositionTranslator
Definition: orientation.hh:262
const TDictMap< E3DImageOrientation > g_image_orientation_map
TAttribute< C3DOrientationAndPosition > C3DImageOrientationPositionAttribute
Definition: orientation.hh:261