orientation.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __mia_3d_oriantation_hh
#define __mia_3d_oriantation_hh
#include <ostream>
#include <istream>
#include <mia/core/attributes.hh>
#include <mia/3d/quaternion.hh>
#include <mia/3d/matrix.hh>
#include <mia/core/vector.hh>
NS_MIA_BEGIN
enum E3DImageOrientation {
ior_undefined = 0,
ior_default = 1,
ior_xyz = 1,
ior_xyz_flipped = 2,
ior_yxz = 3,
ior_yxz_flipped = 4,
ior_xzy = 5,
ior_xzy_flipped = 6,
ior_zxy = 7,
ior_zxy_flipped = 8,
ior_yzx = 9,
ior_yzx_flipped = 10,
ior_zyx = 11,
ior_zyx_flipped = 12,
ior_axial = 1,
ior_axial_flipped = 2,
ior_coronal = 5,
ior_coronal_flipped = 6,
ior_saggital = 9,
ior_saggital_flipped = 10,
ior_unknown = 13,
};
extern const TDictMap<E3DImageOrientation> g_image_orientation_map;
class EXPORT_3D C3DOrientationAndPosition
{
public:
C3DOrientationAndPosition();
explicit C3DOrientationAndPosition(E3DImageOrientation axis);
C3DOrientationAndPosition(E3DImageOrientation axis,
const C3DFVector& origin,
const C3DFVector& scale,
const Quaternion& rot);
void get_transform_parameters(CDoubleVector& params) const;
void get_inverse_transform_parameters(CDoubleVector& params) const;
C3DOrientationAndPosition& operator +=(const C3DOrientationAndPosition& other);
bool operator == (const C3DOrientationAndPosition& other) const;
bool operator < (const C3DOrientationAndPosition& other) const;
void print(std::ostream& os) const;
E3DImageOrientation get_axis_orientation() const;
const mia::C3DFVector& get_scale() const;
const mia::C3DFVector& get_origin()const;
const mia::Quaternion& get_rotation()const;
private:
const C3DFMatrix& get_axis_switch_matrix() const;
E3DImageOrientation m_axisorder;
C3DFVector m_origin;
C3DFVector m_scale;
Quaternion m_rotation;
static const C3DFMatrix ms_order_XYZ;
static const C3DFMatrix ms_order_YXZ;
static const C3DFMatrix ms_order_XZY;
static const C3DFMatrix ms_order_ZYX;
static const C3DFMatrix ms_order_ZXY;
static const C3DFMatrix ms_order_YZX;
static const C3DFMatrix ms_order_XYZ_F;
static const C3DFMatrix ms_order_YXZ_F;
static const C3DFMatrix ms_order_XZY_F;
static const C3DFMatrix ms_order_ZXY_F;
static const C3DFMatrix ms_order_ZYX_F;
static const C3DFMatrix ms_order_YZX_F;
};
enum E3DPatientPositioning {
ipp_undefined = 0,
ipp_hfp,
ipp_hfs,
ipp_hfdr,
ipp_hfdl,
ipp_ffp,
ipp_ffs,
ipp_ffdr,
ipp_ffdl,
ipp_lastindex
};
extern const TDictMap<E3DPatientPositioning> g_patient_position_map;
EXPORT_3D std::ostream& operator << (std::ostream& os, E3DImageOrientation orient);
EXPORT_3D std::istream& operator >> (std::istream& is, E3DImageOrientation& orient);
inline std::ostream& operator << (std::ostream& os, const C3DOrientationAndPosition& orient)
{
orient.print(os);
return os;
}
EXPORT_3D std::istream& operator >> (std::istream& is, C3DOrientationAndPosition& orient);
EXPORT_3D std::ostream& operator << (std::ostream& os, E3DPatientPositioning pp);
EXPORT_3D std::istream& operator >> (std::istream& is, E3DPatientPositioning& pp);
typedef TAttribute<E3DImageOrientation> C3DImageOrientation;
extern template class EXPORT_3D TAttribute<E3DImageOrientation>;
typedef TTranslator<E3DImageOrientation> COrientationTranslator;
extern template class EXPORT_3D TTranslator<E3DImageOrientation>;
typedef TAttribute<E3DPatientPositioning> CPatientPositionAttribute;
extern template class EXPORT_3D TAttribute<E3DPatientPositioning>;
typedef TAttribute<C3DOrientationAndPosition> C3DImageOrientationPositionAttribute;
typedef TTranslator<C3DOrientationAndPosition> COrientationPositionTranslator;
extern template class EXPORT_3D TAttribute<C3DOrientationAndPosition>;
extern template class EXPORT_3D TTranslator<C3DOrientationAndPosition>;
typedef TTranslator<E3DPatientPositioning> CPatientPositionTranslator;
template <>
struct attribute_type<E3DImageOrientation> : public EAttributeType {
static const int value = 3000;
};
template <>
struct attribute_type<E3DPatientPositioning> : public EAttributeType {
static const int value = 3001;
};
template <>
struct attribute_type<C3DOrientationAndPosition>: public EAttributeType {
static const int value = 3002;
};
extern EXPORT_3D const char *IDPatientPosition;
NS_MIA_END
#endif
operator<
bool operator<(const T2DVector< T > &a, const T2DVector< S > &b)
Definition 2d/vector.hh:495
operator+=
EXPORT_2D C2DFVectorfield & operator+=(C2DFVectorfield &a, const C2DFVectorfield &b)
matrix.hh
C3DFMatrix
T3DMatrix< float > C3DFMatrix
a simple 3x3 matrix with single precision floating point values
Definition 3d/matrix.hh:226
C3DFVector
T3DVector< float > C3DFVector
A float 3D Vector.
Definition 3d/vector.hh:409
attributes.hh
operator==
bool operator==(const CAttribute &a, const CAttribute &b)
Definition attributes.hh:95
C3DOrientationAndPosition
This class represents the oriantation and position of a 3D data set.
Definition orientation.hh:88
C3DOrientationAndPosition::get_inverse_transform_parameters
void get_inverse_transform_parameters(CDoubleVector &params) const
C3DOrientationAndPosition::C3DOrientationAndPosition
C3DOrientationAndPosition(E3DImageOrientation axis, const C3DFVector &origin, const C3DFVector &scale, const Quaternion &rot)
C3DOrientationAndPosition::get_origin
const mia::C3DFVector & get_origin() const
C3DOrientationAndPosition::get_axis_orientation
E3DImageOrientation get_axis_orientation() const
C3DOrientationAndPosition::C3DOrientationAndPosition
C3DOrientationAndPosition(E3DImageOrientation axis)
C3DOrientationAndPosition::get_rotation
const mia::Quaternion & get_rotation() const
C3DOrientationAndPosition::get_scale
const mia::C3DFVector & get_scale() const
C3DOrientationAndPosition::C3DOrientationAndPosition
C3DOrientationAndPosition()
C3DOrientationAndPosition::get_transform_parameters
void get_transform_parameters(CDoubleVector &params) const
C3DOrientationAndPosition::print
void print(std::ostream &os) const
Quaternion
a class to implement a quaternion
Definition quaternion.hh:44
TAttribute
Class of an attribute that holds data of type T.
Definition attributes.hh:119
TDictMap
A mapper from emums to string values. - usefull for names flags.
Definition dictmap.hh:46
TTranslator
Generic string vs. attribute translator singleton.
Definition attributes.hh:518
vector.hh
EXPORT_3D
#define EXPORT_3D
Definition defines3d.hh:45
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
operator<<
EXPORT_3D std::ostream & operator<<(std::ostream &os, E3DImageOrientation orient)
Stream operator to write orientation orient to stream os.
operator>>
EXPORT_3D std::istream & operator>>(std::istream &is, E3DImageOrientation &orient)
Stream operator to read orientation orient from stream is.
COrientationTranslator
TTranslator< E3DImageOrientation > COrientationTranslator
translator for 3D image orientations to and from strings
Definition orientation.hh:250
CPatientPositionTranslator
TTranslator< E3DPatientPositioning > CPatientPositionTranslator
translator for the patient position
Definition orientation.hh:271
E3DPatientPositioning
E3DPatientPositioning
Definition orientation.hh:163
C3DImageOrientation
TAttribute< E3DImageOrientation > C3DImageOrientation
attribute for 3D image orientation
Definition orientation.hh:243
E3DImageOrientation
E3DImageOrientation
Definition orientation.hh:40
CPatientPositionAttribute
TAttribute< E3DPatientPositioning > CPatientPositionAttribute
attribute for the patient position
Definition orientation.hh:258
ipp_hfdl
@ ipp_hfdl
Definition orientation.hh:168
ipp_ffp
@ ipp_ffp
Definition orientation.hh:169
ipp_undefined
@ ipp_undefined
Definition orientation.hh:164
ipp_ffs
@ ipp_ffs
Definition orientation.hh:170
ipp_hfdr
@ ipp_hfdr
Definition orientation.hh:167
ipp_hfp
@ ipp_hfp
Definition orientation.hh:165
ipp_ffdl
@ ipp_ffdl
Definition orientation.hh:172
ipp_ffdr
@ ipp_ffdr
Definition orientation.hh:171
ipp_lastindex
@ ipp_lastindex
Definition orientation.hh:173
ipp_hfs
@ ipp_hfs
Definition orientation.hh:166
ior_yxz_flipped
@ ior_yxz_flipped
Definition orientation.hh:48
ior_xzy
@ ior_xzy
Definition orientation.hh:50
ior_saggital
@ ior_saggital
Definition orientation.hh:65
ior_coronal_flipped
@ ior_coronal_flipped
Definition orientation.hh:64
ior_axial
@ ior_axial
Definition orientation.hh:61
ior_yzx
@ ior_yzx
Definition orientation.hh:55
ior_xzy_flipped
@ ior_xzy_flipped
Definition orientation.hh:51
ior_undefined
@ ior_undefined
Definition orientation.hh:42
ior_default
@ ior_default
Definition orientation.hh:43
ior_yxz
@ ior_yxz
Definition orientation.hh:47
ior_zxy_flipped
@ ior_zxy_flipped
Definition orientation.hh:53
ior_yzx_flipped
@ ior_yzx_flipped
Definition orientation.hh:56
ior_xyz_flipped
@ ior_xyz_flipped
Definition orientation.hh:46
ior_zxy
@ ior_zxy
Definition orientation.hh:52
ior_axial_flipped
@ ior_axial_flipped
Definition orientation.hh:62
ior_xyz
@ ior_xyz
Definition orientation.hh:45
ior_coronal
@ ior_coronal
Definition orientation.hh:63
ior_unknown
@ ior_unknown
Definition orientation.hh:69
ior_zyx
@ ior_zyx
Definition orientation.hh:57
ior_zyx_flipped
@ ior_zyx_flipped
Definition orientation.hh:58
ior_saggital_flipped
@ ior_saggital_flipped
Definition orientation.hh:66
CDoubleVector
TCArrayWrapper< double > CDoubleVector
Definition core/vector.hh:266
IDPatientPosition
EXPORT_3D const char * IDPatientPosition
g_patient_position_map
const TDictMap< E3DPatientPositioning > g_patient_position_map
COrientationPositionTranslator
TTranslator< C3DOrientationAndPosition > COrientationPositionTranslator
Definition orientation.hh:262
g_image_orientation_map
const TDictMap< E3DImageOrientation > g_image_orientation_map
C3DImageOrientationPositionAttribute
TAttribute< C3DOrientationAndPosition > C3DImageOrientationPositionAttribute
Definition orientation.hh:261
quaternion.hh
EAttributeType
Definition attributetype.hh:32
attribute_type< C3DOrientationAndPosition >::value
static const int value
Definition orientation.hh:285
attribute_type< E3DImageOrientation >::value
static const int value
Definition orientation.hh:275
attribute_type< E3DPatientPositioning >::value
static const int value
Definition orientation.hh:280
attribute_type
Definition attributetype.hh:65