1 /*=========================================================================
4 Module: $RCSfile: gdcmOrientation.h,v $
6 Date: $Date: 2005/11/28 16:31:23 $
7 Version: $Revision: 1.17 $
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"
35 typedef std::pair<double, double> Res;
47 HeartAxialInvert = -4,
49 HeartCoronalInvert = -5,
51 HeartSagitalInvert = -6
54 //-----------------------------------------------------------------------------
56 * \brief Orientation class for dealing with DICOM image orientation
58 * A gentle reminder for non-medical user:
59 * PatientPosition (0x0010,0x5100) tells us the way the patient was introduced in the imager
60 * - HFS : Head First Supine
61 * - FFS : Feet First Supine
62 * - HFP : Head First Prone
63 * - FFP : Feet First Prone
64 * Note: HFP and FFP are not very common values, since the position must
65 * be pretty unconfortable for the Patient -the patient is lying on his belly; but, if he has handcuffs there is no other way ...-
67 * ImageOrientationPatient (0x0020,0x0037) gives 6 cosines (2 for each plane)
68 * Patient Orientation (as found in the optional 0x0020,0x0020, or computed by
69 * std::string Orientation::GetOrientation ( File *f ), tells us about the direction of X and Y axes.
72 * - A/P anterior/posterior
75 * One can see it as "values within a 'Patient referential".
78 * Imagine the patient, in "HFS" position.
79 * Full body sagital images are requested.
80 * All the cosines will be -1, 0, or +1;
81 * "Patient Orientation" (deduced) will be "A/F".
82 * Positive X axis is oriented 'towards patient's nose
83 * Positive Y axis is oriented 'towards patient's feet
86 * Imagine now that patient has a stiffneck and his head is *turned* 30 degrees towards the left.
87 * Head sagital images are requested.
88 * One of the cosines will be almost 0.5
89 * Deduced "Patient Orientation" will be "AL\F"
90 * (main X axis orientation is towards patient's nose, and a little bit towards the left)
91 * but the image looks *perfectly* sagital (for the head, not for the patient) !
93 * Imagine the patient's stiffneck causes head to be *bended* 30 degrees towards the left AND *turned* left.
94 * Sagital images are requested...
95 * You'll probabely have 3 letters for X axis and Y axis, and the image remains *perfectly* sagital !
96 * The values are given within the 'Patient referential', *not* within the 'Organ referential' ...
99 class GDCM_EXPORT Orientation : public RefCounter
101 gdcmTypeMacro(Orientation);
103 /// \brief Constructs a gdcm::Orientation with a RefCounter
104 static Orientation *New() {return new Orientation();}
106 OrientationType GetOrientationType( File *file );
107 std::string GetOrientation ( File *file );
109 static const char* GetOrientationTypeString(OrientationType const o);
112 /// \brief Constructor
114 /// \brief Canonical Destructor
117 Res VerfCriterion(int typeCriterion, double criterionNew, Res const &res);
118 double CalculLikelyhood2Vec(vector3D const &refA, vector3D const &refB,
119 vector3D const &ori1, vector3D const &ori2);
120 vector3D ProductVectorial(vector3D const &vec1, vector3D const &vec2);
121 std::string GetSingleOrientation ( float *iop);
123 } // end namespace gdcm
124 //-----------------------------------------------------------------------------