#include <gdcmOrientation.h>
Inheritance diagram for gdcm::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 () |
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) |
Definition at line 95 of file gdcmOrientation.h.
|
Constructor.
Definition at line 108 of file gdcmOrientation.h.
|
|
Canonical Destructor.
Definition at line 110 of file gdcmOrientation.h.
|
|
Definition at line 180 of file gdcmOrientation.cxx. References ProductVectorial(), and gdcm::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 293 of file gdcmOrientation.cxx. References gdcm::GDCM_UNFOUND, gdcm::File::GetImageOrientationPatient(), and GetSingleOrientation(). Referenced by gdcm::FileHelper::CheckMandatoryElements(). 00294 { 00295 float iop[6]; 00296 if ( !f->GetImageOrientationPatient( iop ) ) 00297 return GDCM_UNFOUND; 00298 00299 std::string orientation; 00300 orientation = GetSingleOrientation ( iop ) 00301 + "\\" 00302 + GetSingleOrientation ( iop + 3 ); 00303 return orientation; 00304 }
|
|
returns of the most similar basic orientation (Axial, Coronal, Sagital, ...) of the image
Definition at line 85 of file gdcmOrientation.cxx. References CalculLikelyhood2Vec(), gdcmAssertMacro, gdcmErrorMacro, gdcm::File::GetImageOrientationPatient(), gdcm::NotApplicable, VerfCriterion(), gdcm::vector3D::x, gdcm::vector3D::y, and gdcm::vector3D::z. 00086 { 00087 float iop[6]; 00088 bool succ = f->GetImageOrientationPatient( iop ); 00089 if ( !succ ) 00090 { 00091 gdcmErrorMacro( "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::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 57 of file gdcmRefCounter.h. 00058 { 00059 return RefCount; 00060 }
|
|
Definition at line 307 of file gdcmOrientation.cxx. Referenced by GetOrientation(). 00308 { 00309 std::string orientation; 00310 00311 char orientationX = iop[0] < 0 ? 'R' : 'L'; 00312 char orientationY = iop[1] < 0 ? 'A' : 'P'; 00313 char orientationZ = iop[2] < 0 ? 'F' : 'H'; 00314 00315 double absX = iop[0]; 00316 if (absX < 0) absX = -absX; 00317 double absY = iop[1]; 00318 if (absY < 0) absY = -absY; 00319 double absZ = iop[2]; 00320 if (absZ < 0) absZ = -absZ; 00321 00322 for (int i=0; i<3; ++i) 00323 { 00324 if (absX>.0001 && absX>absY && absX>absZ) 00325 { 00326 orientation = orientation + orientationX; 00327 absX=0; 00328 } 00329 else if (absY>.0001 && absY>absX && absY>absZ) 00330 { 00331 orientation = orientation + orientationY; 00332 absY=0; 00333 } 00334 else if (absZ>.0001 && absZ>absX && absZ>absY) 00335 { 00336 orientation = orientation + orientationZ; 00337 absZ=0; 00338 } 00339 else 00340 break; 00341 } 00342 return orientation; 00343 }
|
|
Definition at line 99 of file gdcmOrientation.h. Referenced by gdcm::FileHelper::CheckMandatoryElements(). 00099 {return new Orientation();}
|
|
Printer.
Reimplemented in gdcm::DataEntry, gdcm::DicomDir, gdcm::DicomDirElement, gdcm::DicomDirImage, gdcm::DicomDirMeta, gdcm::DicomDirPatient, gdcm::DicomDirSerie, gdcm::DicomDirStudy, gdcm::DicomDirVisit, gdcm::DicomEntry, gdcm::Dict, gdcm::DictEntry, gdcm::DictGroupName, gdcm::DictSet, gdcm::DocEntry, gdcm::ElementSet, gdcm::FileHelper, gdcm::PixelReadConvert, gdcm::SeqEntry, gdcm::SerieHelper, gdcm::SQItem, and gdcm::VR. Definition at line 42 of file gdcmBase.h.
|
|
Definition at line 200 of file gdcmOrientation.cxx. References gdcm::vector3D::x, gdcm::vector3D::y, and gdcm::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 45 of file gdcmRefCounter.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem(). 00045 { RefCount++; }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Unregister the object.
Definition at line 49 of file gdcmRefCounter.h. Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().
|
|
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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print(). |