]> Creatis software - gdcm.git/commitdiff
To please Python, add accesors on each Orientation cosine
authorjpr <jpr>
Wed, 15 Nov 2006 15:54:15 +0000 (15:54 +0000)
committerjpr <jpr>
Wed, 15 Nov 2006 15:54:15 +0000 (15:54 +0000)
src/gdcmFile.cxx
src/gdcmFile.h
src/gdcmOrientation.cxx

index 23c97b24f1e93689140443f9e884e32196f3666b..38282e941cd6878af59f49f9deb65174eb1d6e8a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/11/08 17:03:38 $
-  Version:   $Revision: 1.326 $
+  Date:      $Date: 2006/11/15 15:54:15 $
+  Version:   $Revision: 1.327 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -999,6 +999,77 @@ bool File::GetImageOrientationPatient( float iop[6] )
    return false;
 }
 
+/**
+  * \brief gets the cosine of image X axis, against patient X axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image X axis, against patient X axis 
+  */
+float File::GetXCosineOnX()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[0]);
+}
+   
+/**
+  * \brief gets the cosine of image X axis, against patient Y axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image X axis, against patient Y axis 
+  */
+float File::GetXCosineOnY()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[1]);
+}   
+
+/**
+  * \brief gets the cosine of image X axis, against patient Z axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image X axis, against patient Z axis 
+  */
+float File::GetXCosineOnZ()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[2]);
+}   
+
+/**
+  * \brief gets the cosine of image Y axis, against patient X axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image Y axis, against patient X axis 
+  */
+float File::GetYCosineOnX()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[3]);
+}
+   
+/**
+  * \brief gets the cosine of image Y axis, against patient Y axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image Y axis, against patient Y axis 
+  */
+float File::GetYCosineOnY()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[4]);
+}   
+
+/**
+  * \brief gets the cosine of image Y axis, against patient Z axis
+  *        (Sorry, but Python needs it :-( )
+  * @return cosine of image Y axis, against patient Z axis 
+  */
+float File::GetYCosineOnZ()
+{  
+   float iop[6];
+   GetImageOrientationPatient( iop );
+   return(iop[5]);
+}    
 /**
   * \brief gets the info from 0020,0032 : Image Position Patient
   *                   or from 0020 0030 : Image Position (RET)
@@ -1012,13 +1083,14 @@ bool File::GetImageOrientationPatient( float iop[6] )
 bool File::GetImagePositionPatient( float ipp[3] )
 {
    std::string strImPosiPat;
-   //iop is supposed to be float[3]
+   //ipp is supposed to be float[3]
    ipp[0] = ipp[1] = ipp[2] = 0.;
 
    // 0020 0032 DS REL Image Position (Patient)
-   if ( (strImPosiPat = GetEntryString(0x0020,0x0032)) != GDCM_UNFOUND )
+   strImPosiPat = GetEntryString(0x0020,0x0032);
+   if ( strImPosiPat != GDCM_UNFOUND )
    {
-      if ( sscanf( strImPosiPat.c_str(), "%f \\ %f \\%f", 
+      if ( sscanf( strImPosiPat.c_str(), "%f \\ %f \\%f ", 
           &ipp[0], &ipp[1], &ipp[2]) != 3 )
       {
          gdcmWarningMacro( "Wrong Image Position Patient (0020,0032)."
@@ -1034,7 +1106,7 @@ bool File::GetImagePositionPatient( float ipp[3] )
       if ( sscanf( strImPosiPat.c_str(), "%f \\ %f \\%f ", 
           &ipp[0], &ipp[1], &ipp[2]) != 3 )
       {
-         gdcmWarningMacro( "wrong Image Position Patient (0020,0035). "
+         gdcmWarningMacro( "wrong Image Position Patient (0020,0030). "
                         << "Less than 3 values were found." );
          return false;
       }
index dd42b0b275be57553daf5bcb2abfa2d0375c5677..1eb3efc2b0cbbcf1b2426ecfc285bdeb2ebd537f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.h,v $
   Language:  C++
-  Date:      $Date: 2006/11/08 17:03:38 $
-  Version:   $Revision: 1.129 $
+  Date:      $Date: 2006/11/15 15:54:15 $
+  Version:   $Revision: 1.130 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -128,7 +128,14 @@ public:
    float GetXOrigin();
    float GetYOrigin();
    float GetZOrigin();
-
+   
+   float GetXCosineOnX();
+   float GetXCosineOnY();  
+   float GetXCosineOnZ();
+   float GetYCosineOnX();
+   float GetYCosineOnY();  
+   float GetYCosineOnZ();   
+     
    bool GetImageOrientationPatient( float iop[6] );
    bool GetImagePositionPatient( float ipp[3] );
    
index 397fbff0cdbe726aa8cac9bed26215d47f6ad90e..c22325d850a84780585830fd76d774403689f4ca 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmOrientation.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/19 11:46:46 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2006/11/15 15:54:15 $
+  Version:   $Revision: 1.24 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -88,7 +88,7 @@ OrientationType Orientation::GetOrientationType( File *f )
    bool succ = f->GetImageOrientationPatient( iop );
    if ( !succ )
    {
-      gdcmErrorMacro( "No Image Orientation (0020,0037)/(0020,0032) found in the file, cannot proceed." )
+      gdcmWarningMacro( "No Image Orientation (0020,0037)/(0020,0032) found in the file, cannot proceed." )
       return NotApplicable;
    }
    vector3D ori1;