#include <gdcmOrientation.h>
Inheritance diagram for GDCM_NAME_SPACE::Orientation:
Public Member Functions | |
OrientationType | GetOrientationType (File *file) |
returns of the most similar basic orientation (Axial, Coronal, Sagital, ...) of the image | |
std::string | GetOrientation (File *file) |
Computes the Patient Orientation relative to the image plane from the 'Image Orientation (Patient)'
| |
void | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
virtual void | Print (std::ostream &=std::cout, std::string const &="") |
Printer. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static Orientation * | New () |
Constructs a gdcm::Orientation with a RefCounter. | |
static const char * | GetOrientationTypeString (OrientationType const o) |
returns human readable interpretation of the most similar basic orientation (Axial, Coronal, Sagital, ...) of the image | |
Protected Member Functions | |
Orientation () | |
Constructor. | |
~Orientation () | |
Canonical Destructor. | |
Protected Attributes | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Member Functions | |
gdcmTypeMacro (Orientation) | |
Res | VerfCriterion (int typeCriterion, double criterionNew, Res const &res) |
double | CalculLikelyhood2Vec (vector3D const &refA, vector3D const &refB, vector3D const &ori1, vector3D const &ori2) |
vector3D | ProductVectorial (vector3D const &vec1, vector3D const &vec2) |
std::string | GetSingleOrientation (float *iop) |
A gentle reminder for non-medical user: PatientPosition (0x0010,0x5100) tells us the way the patient was introduced in the imager
ImageOrientationPatient (0x0020,0x0037) gives 6 cosines (2 for each plane) Patient Orientation (as found in the optional 0x0020,0x0020, or computed by std::string Orientation::GetOrientation ( File *f ), tells us about the direction of X and Y axes.
The values can be
Example #1: Imagine the patient, in "HFS" position. Full body sagital images are requested. All the cosines will be -1, 0, or +1; "Patient Orientation" (deduced) will be "A/F". Positive X axis is oriented 'towards patient's nose Positive Y axis is oriented 'towards patient's feet
Example #2: Imagine now that patient has a stiffneck and his head is *turned* 30 degrees towards the left. Head sagital images are requested. One of the cosines will be almost 0.5 Deduced "Patient Orientation" will be "AL\F" (main X axis orientation is towards patient's nose, and a little bit towards the left) but the image looks *perfectly* sagital (for the head, not for the patient) !
Imagine the patient's stiffneck causes head to be *bended* 30 degrees towards the left AND *turned* left. Sagital images are requested... You'll probabely have 3 letters for X axis and Y axis, and the image remains *perfectly* sagital ! The values are given within the 'Patient referential', *not* within the 'Organ referential' ...
Definition at line 98 of file gdcmOrientation.h.
|
Constructor.
Definition at line 112 of file gdcmOrientation.h.
|
|
Canonical Destructor.
Definition at line 114 of file gdcmOrientation.h.
|
|
Definition at line 180 of file gdcmOrientation.cxx. References ProductVectorial(), and GDCM_NAME_SPACE::square_dist(). Referenced by GetOrientationType(). 00182 { 00183 00184 vector3D ori3 = ProductVectorial(ori1,ori2); 00185 vector3D refC = ProductVectorial(refA,refB); 00186 double res = square_dist(refC, ori3); 00187 00188 return sqrt(res); 00189 }
|
|
|
|
|
Computes the Patient Orientation relative to the image plane from the 'Image Orientation (Patient)'
Definition at line 294 of file gdcmOrientation.cxx. References GDCM_NAME_SPACE::GDCM_UNFOUND, GDCM_NAME_SPACE::File::GetImageOrientationPatient(), and GetSingleOrientation(). 00295 { 00296 float iop[6]; 00297 if ( !f->GetImageOrientationPatient( iop ) ) 00298 return GDCM_UNFOUND; 00299 00300 std::string orientation; 00301 orientation = GetSingleOrientation ( iop ) 00302 + "\\" 00303 + GetSingleOrientation ( iop + 3 ); 00304 return orientation; 00305 }
|
|
returns of the most similar basic orientation (Axial, Coronal, Sagital, ...) of the image
Definition at line 85 of file gdcmOrientation.cxx. References CalculLikelyhood2Vec(), gdcmWarningMacro, GDCM_NAME_SPACE::File::GetImageOrientationPatient(), GDCM_NAME_SPACE::NotApplicable, VerfCriterion(), GDCM_NAME_SPACE::vector3D::x, GDCM_NAME_SPACE::vector3D::y, and GDCM_NAME_SPACE::vector3D::z. 00086 { 00087 float iop[6]; 00088 bool succ = f->GetImageOrientationPatient( iop ); 00089 if ( !succ ) 00090 { 00091 gdcmWarningMacro( "No Image Orientation (0020,0037)/(0020,0032) found in the file, cannot proceed." ) 00092 return NotApplicable; 00093 } 00094 vector3D ori1; 00095 vector3D ori2; 00096 00097 ori1.x = iop[0]; ori1.y = iop[1]; ori1.z = iop[2]; 00098 ori2.x = iop[3]; ori2.y = iop[4]; ori2.z = iop[5]; 00099 00100 // two perpendicular vectors describe one plane 00101 double dicPlane[6][2][3] = 00102 { { { 1, 0, 0 },{ 0, 1, 0 } }, // Axial 00103 { { 1, 0, 0 },{ 0, 0, -1 } }, // Coronal 00104 { { 0, 1, 0 },{ 0, 0, -1 } }, // Sagittal 00105 { { 0.8, 0.5, 0.0 },{-0.1, 0.1 , -0.95 } }, // Axial - HEART 00106 { { 0.8, 0.5, 0.0 },{-0.6674, 0.687, 0.1794} }, // Coronal - HEART 00107 { {-0.1, 0.1, -0.95},{-0.6674, 0.687, 0.1794} } // Sagittal - HEART 00108 }; 00109 00110 vector3D refA; 00111 vector3D refB; 00112 int i = 0; 00113 Res res; // [ <result> , <memory of the last succes calcule> ] 00114 res.first = 0; 00115 res.second = 99999; 00116 00117 for (int numDicPlane=0; numDicPlane<6; numDicPlane++) 00118 { 00119 ++i; 00120 // refA=plane[0] 00121 refA.x = dicPlane[numDicPlane][0][0]; 00122 refA.y = dicPlane[numDicPlane][0][1]; 00123 refA.z = dicPlane[numDicPlane][0][2]; 00124 // refB=plane[1] 00125 refB.x = dicPlane[numDicPlane][1][0]; 00126 refB.y = dicPlane[numDicPlane][1][1]; 00127 refB.z = dicPlane[numDicPlane][1][2]; 00128 res=VerfCriterion( i, CalculLikelyhood2Vec(refA,refB,ori1,ori2), res ); 00129 res=VerfCriterion( -i, CalculLikelyhood2Vec(refB,refA,ori1,ori2), res ); 00130 } 00131 // res thought looks like is a float value, but is indeed an int 00132 // try casting it to int first then enum value to please VS7: 00133 int int_res = (int)res.first; 00134 gdcmAssertMacro( int_res <= 6 && int_res >= -6); 00135 return (OrientationType)int_res; 00136 }
|
|
returns human readable interpretation of the most similar basic orientation (Axial, Coronal, Sagital, ...) of the image
Definition at line 74 of file gdcmOrientation.cxx. References GDCM_NAME_SPACE::OrientationTypeStrings. 00075 { 00076 int k = (int)o; 00077 if (k < 0) 00078 k = -k + 6; 00079 00080 return OrientationTypeStrings[k]; 00081 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Get the reference counting.
Definition at line 59 of file gdcmRefCounter.h. 00060 { 00061 return RefCount; 00062 }
|
|
Definition at line 308 of file gdcmOrientation.cxx. Referenced by GetOrientation(). 00309 { 00310 std::string orientation; 00311 00312 char orientationX = iop[0] < 0 ? 'R' : 'L'; 00313 char orientationY = iop[1] < 0 ? 'A' : 'P'; 00314 char orientationZ = iop[2] < 0 ? 'F' : 'H'; 00315 00316 double absX = iop[0]; 00317 if (absX < 0) absX = -absX; 00318 double absY = iop[1]; 00319 if (absY < 0) absY = -absY; 00320 double absZ = iop[2]; 00321 if (absZ < 0) absZ = -absZ; 00322 00323 for (int i=0; i<3; ++i) 00324 { 00325 if (absX>.0001 && absX>absY && absX>absZ) 00326 { 00327 orientation = orientation + orientationX; 00328 absX=0; 00329 } 00330 else if (absY>.0001 && absY>absX && absY>absZ) 00331 { 00332 orientation = orientation + orientationY; 00333 absY=0; 00334 } 00335 else if (absZ>.0001 && absZ>absX && absZ>absY) 00336 { 00337 orientation = orientation + orientationZ; 00338 absZ=0; 00339 } 00340 else 00341 break; 00342 } 00343 return orientation; 00344 }
|
|
Constructs a gdcm::Orientation with a RefCounter.
Definition at line 103 of file gdcmOrientation.h. 00103 {return new Orientation();}
|
|
|
Definition at line 200 of file gdcmOrientation.cxx. References GDCM_NAME_SPACE::vector3D::x, GDCM_NAME_SPACE::vector3D::y, and GDCM_NAME_SPACE::vector3D::z. Referenced by CalculLikelyhood2Vec(). 00201 { 00202 vector3D vec3; 00203 vec3.x = vec1.y*vec2.z - vec1.z*vec2.y; 00204 vec3.y = -( vec1.x*vec2.z - vec1.z*vec2.x); 00205 vec3.z = vec1.x*vec2.y - vec1.y*vec2.x; 00206 00207 return vec3; 00208 }
|
|
Register the object.
Definition at line 46 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem(). 00046 { RefCount++; }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Unregister the object.
Definition at line 50 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper(). 00051 { 00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl; 00053 RefCount--; 00054 if(RefCount<=0) 00055 delete this; 00056 }
|
|
Definition at line 139 of file gdcmOrientation.cxx. Referenced by GetOrientationType(). 00140 { 00141 Res res; 00142 double type = in.first; 00143 double criterion = in.second; 00144 if (/*criterionNew < 0.1 && */criterionNew < criterion) 00145 { 00146 type = typeCriterion; 00147 criterion = criterionNew; 00148 } 00149 res.first = type; 00150 res.second = criterion; 00151 return res; 00152 }
|
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and GDCM_NAME_SPACE::DataEntry::Print(). |