1 /*=========================================================================
4 Module: $RCSfile: gdcmOrientation.h,v $
6 Date: $Date: 2008/08/18 12:27:10 $
7 Version: $Revision: 1.21 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef _GDCMORIENTATION_H_
20 #define _GDCMORIENTATION_H_
22 #include "gdcmRefCounter.h"
25 namespace GDCM_NAME_SPACE
34 typedef std::pair<double, double> Res;
46 HeartAxialInvert = -4,
48 HeartCoronalInvert = -5,
50 HeartSagittalInvert = -6
53 //-----------------------------------------------------------------------------
55 * \brief Orientation class for dealing with DICOM image orientation
57 * A gentle reminder for non-medical user:
58 * PatientPosition (0x0010,0x5100) tells us the way the patient was introduced in the imager
59 * - HFS : Head First Supine
60 * - FFS : Feet First Supine
61 * - HFP : Head First Prone
62 * - FFP : Feet First Prone
63 * Note: HFP and FFP are not very common values, since the position must
64 * be pretty unconfortable for the Patient -the patient is lying on his belly; but, if he has handcuffs there is no other way ...-
66 * ImageOrientationPatient (0x0020,0x0037) gives 6 cosines (2 for each plane)
67 * Patient Orientation (as found in the optional 0x0020,0x0020, or computed by
68 * std::string Orientation::GetOrientation ( File *f ), tells us about the direction of X and Y axes.
71 * - A/P anterior/posterior
74 * One can see it as "values within a 'Patient referential".
77 * Imagine the patient, in "HFS" position.
78 * Full body sagittal images are requested.
79 * All the cosines will be -1, 0, or +1;
80 * "Patient Orientation" (deduced) will be "A/F".
81 * Positive X axis is oriented 'towards patient's nose
82 * Positive Y axis is oriented 'towards patient's feet
85 * Imagine now that patient has a stiffneck and his head is *turned* 30 degrees towards the left.
86 * Head sagittal images are requested.
87 * One of the cosines will be almost 0.5
88 * Deduced "Patient Orientation" will be "AL\F"
89 * (main X axis orientation is towards patient's nose, and a little bit towards the left)
90 * but the image looks *perfectly* sagittal (for the head, not for the patient) !
92 * Imagine the patient's stiffneck causes head to be *bended* 30 degrees towards the left AND *turned* left.
93 * Sagittal images are requested...
94 * You'll probabely have 3 letters for X axis and Y axis, and the image remains *perfectly* sagittal !
95 * The values are given within the 'Patient referential', *not* within the 'Organ referential' ...
98 class GDCM_EXPORT Orientation : public RefCounter
100 gdcmTypeMacro(Orientation);
102 /// \brief Constructs a gdcm::Orientation with a RefCounter
103 static Orientation *New() {return new Orientation();}
105 OrientationType GetOrientationType( File *file );
106 std::string GetOrientation ( File *file );
108 static const char* GetOrientationTypeString(OrientationType const o);
111 /// \brief Constructor
113 /// \brief Canonical Destructor
116 Res VerfCriterion(int typeCriterion, double criterionNew, Res const &res);
117 double CalculLikelyhood2Vec(vector3D const &refA, vector3D const &refB,
118 vector3D const &ori1, vector3D const &ori2);
119 vector3D ProductVectorial(vector3D const &vec1, vector3D const &vec2);
120 std::string GetSingleOrientation ( float *iop);
122 } // end namespace gdcm
123 //-----------------------------------------------------------------------------