Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gdcm::Orientation Class Reference

#include <gdcmOrientation.h>

Inheritance diagram for gdcm::Orientation:

Inheritance graph
[legend]
Collaboration diagram for gdcm::Orientation:

Collaboration graph
[legend]
List of all members.

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)'
  • The first entry is the direction of the rows, given by the direction of the last pixel in the first row from the first pixel in that row.
  • The second entry is the direction of the columns, given by the direction of the last pixel in the first column from the first pixel in that column. Anatomical direction is designated by the capital letters: A (anterior), P (posterior), R (right),L (left), H (head), F (foot).
  • Refinements in the orientation descriptions are designated by one or two additional letters in each value. Use it when "Patient Orientation" (0020,0020) is not found.

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 OrientationNew ()
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)

Detailed Description

Definition at line 95 of file gdcmOrientation.h.


Constructor & Destructor Documentation

gdcm::Orientation::Orientation  )  [inline, protected]
 

Constructor.

Definition at line 108 of file gdcmOrientation.h.

00108 {}

gdcm::Orientation::~Orientation  )  [inline, protected]
 

Canonical Destructor.

Definition at line 110 of file gdcmOrientation.h.

00110 {}


Member Function Documentation

double gdcm::Orientation::CalculLikelyhood2Vec vector3D const &  refA,
vector3D const &  refB,
vector3D const &  ori1,
vector3D const &  ori2
[private]
 

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 }

void gdcm::RefCounter::Delete  )  [inline, inherited]
 

Delete the object.

Remarks:
The object is deleted only if its reference counting is to zero

Definition at line 40 of file gdcmRefCounter.h.

Referenced by gdcm::SerieHelper::AddFileName(), gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDir::CreateDicomDirChainedList(), gdcm::File::DoTheLoadingJob(), gdcm::Dict::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::DocEntrySet::InsertSeqEntry(), gdcm::DicomDir::NewMeta(), gdcm::DicomDirStudy::NewVisit(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::Document::ReadNextDocEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), gdcm::DicomDir::~DicomDir(), and gdcm::Global::~Global().

00040 { Unregister(); }

gdcm::Orientation::gdcmTypeMacro Orientation   )  [private]
 

std::string gdcm::Orientation::GetOrientation File f  ) 
 

Computes the Patient Orientation relative to the image plane from the 'Image Orientation (Patient)'

  • The first entry is the direction of the rows, given by the direction of the last pixel in the first row from the first pixel in that row.
  • The second entry is the direction of the columns, given by the direction of the last pixel in the first column from the first pixel in that column. Anatomical direction is designated by the capital letters: A (anterior), P (posterior), R (right),L (left), H (head), F (foot).
  • Refinements in the orientation descriptions are designated by one or two additional letters in each value. Use it when "Patient Orientation" (0020,0020) is not found.

Returns:
orientation string as "rawOrientation\columnsOrientation"

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 }

OrientationType gdcm::Orientation::GetOrientationType File file  ) 
 

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 }

const char * gdcm::Orientation::GetOrientationTypeString OrientationType const   o  )  [static]
 

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 }

int gdcm::Base::GetPrintLevel  )  [inline, inherited]
 

Gets the print level for the Dicom Entries.

Definition at line 50 of file gdcmBase.h.

00050 { return PrintLevel; }

const unsigned long& gdcm::RefCounter::GetRefCount  )  const [inline, inherited]
 

Get the reference counting.

Returns:
Reference count

Definition at line 57 of file gdcmRefCounter.h.

00058    {
00059       return RefCount;
00060    }

std::string gdcm::Orientation::GetSingleOrientation float *  iop  )  [private]
 

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 } 

static Orientation* gdcm::Orientation::New  )  [inline, static]
 

Definition at line 99 of file gdcmOrientation.h.

Referenced by gdcm::FileHelper::CheckMandatoryElements().

00099 {return new Orientation();}

virtual void gdcm::Base::Print std::ostream &  = std::cout,
std::string const &  = ""
[inline, virtual, inherited]
 

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.

00043                                                {};

vector3D gdcm::Orientation::ProductVectorial vector3D const &  vec1,
vector3D const &  vec2
[private]
 

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 }

void gdcm::RefCounter::Register  )  [inline, inherited]
 

Register the object.

Remarks:
It increments the reference counting

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++; }

void gdcm::Base::SetPrintLevel int  level  )  [inline, inherited]
 

Sets the print level for the Dicom Header Elements.

Note:
0 for Light Print; 1 for 'medium' Print, 2 for Heavy Print

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; }

void gdcm::RefCounter::Unregister  )  [inline, inherited]
 

Unregister the object.

Remarks:
It decrements the reference counting

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().

00050    {
00051       RefCount--;
00052       if(RefCount<=0)
00053          delete this;
00054    }

Res gdcm::Orientation::VerfCriterion int  typeCriterion,
double  criterionNew,
Res const &  res
[private]
 

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 } 


Member Data Documentation

int gdcm::Base::PrintLevel [protected, inherited]
 

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().


The documentation for this class was generated from the following files:
Generated on Fri Nov 18 15:58:41 2005 for gdcm by  doxygen 1.4.4