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
28#include <mia/3d/quaternion.hh>
29#include <mia/3d/matrix.hh>
30#include <mia/core/vector.hh>
31
33
34
71
72
74
88{
89public:
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
118 const mia::C3DFVector& get_origin()const;
119
121 const mia::Quaternion& get_rotation()const;
122
123private:
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
175
176
178
186EXPORT_3D std::ostream& operator << (std::ostream& os, E3DImageOrientation orient);
187
195EXPORT_3D std::istream& operator >> (std::istream& is, E3DImageOrientation& orient);
196
197
205inline std::ostream& operator << (std::ostream& os, const C3DOrientationAndPosition& orient)
206{
207 orient.print(os);
208 return os;
209}
210
218EXPORT_3D std::istream& operator >> (std::istream& is, C3DOrientationAndPosition& orient);
219
220
228EXPORT_3D std::ostream& operator << (std::ostream& os, E3DPatientPositioning pp);
229
237EXPORT_3D std::istream& operator >> (std::istream& is, E3DPatientPositioning& pp);
238
244extern template class EXPORT_3D TAttribute<E3DImageOrientation>;
245
251extern template class EXPORT_3D TTranslator<E3DImageOrientation>;
252
253
259extern template class EXPORT_3D TAttribute<E3DPatientPositioning>;
260
263
266
272
273template <>
275 static const int value = 3000;
276};
277
278template <>
280 static const int value = 3001;
281};
282
283template <>
285 static const int value = 3002;
286};
287
288
289
290extern 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)
bool operator==(const CAttribute &a, const CAttribute &b)
Definition attributes.hh:95
This class represents the oriantation and position of a 3D data set.
void get_inverse_transform_parameters(CDoubleVector &params) const
C3DOrientationAndPosition(E3DImageOrientation axis, const C3DFVector &origin, const C3DFVector &scale, const Quaternion &rot)
const mia::C3DFVector & get_origin() const
E3DImageOrientation get_axis_orientation() const
C3DOrientationAndPosition(E3DImageOrientation axis)
const mia::Quaternion & get_rotation() 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.
A wrapper around the c-array to provide an STL like interface for iterators.
A mapper from emums to string values. - usefull for names flags.
Definition dictmap.hh:46
Generic string vs. attribute translator singleton.
#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::ostream & operator<<(std::ostream &os, E3DImageOrientation orient)
Stream operator to write orientation orient to stream os.
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
TTranslator< E3DPatientPositioning > CPatientPositionTranslator
translator for the patient position
E3DPatientPositioning
TAttribute< E3DImageOrientation > C3DImageOrientation
attribute for 3D image orientation
E3DImageOrientation
TAttribute< E3DPatientPositioning > CPatientPositionAttribute
attribute for the patient position
@ ipp_hfdl
@ ipp_ffp
@ ipp_undefined
@ ipp_ffs
@ ipp_hfdr
@ ipp_hfp
@ ipp_ffdl
@ ipp_ffdr
@ ipp_lastindex
@ ipp_hfs
@ ior_yxz_flipped
@ ior_xzy
@ ior_saggital
@ ior_coronal_flipped
@ ior_axial
@ ior_yzx
@ ior_xzy_flipped
@ ior_undefined
@ ior_default
@ ior_yxz
@ ior_zxy_flipped
@ ior_yzx_flipped
@ ior_xyz_flipped
@ ior_zxy
@ ior_axial_flipped
@ ior_xyz
@ ior_coronal
@ ior_unknown
@ ior_zyx
@ ior_zyx_flipped
@ ior_saggital_flipped
EXPORT_3D const char * IDPatientPosition
const TDictMap< E3DPatientPositioning > g_patient_position_map
TTranslator< C3DOrientationAndPosition > COrientationPositionTranslator
const TDictMap< E3DImageOrientation > g_image_orientation_map
TAttribute< C3DOrientationAndPosition > C3DImageOrientationPositionAttribute