[ITK-users] SpatialOrientationAdapter

Francois Budin fbudin at email.unc.edu
Fri May 22 15:59:21 EDT 2015


Hello Everybody,

I was trying to use itk::SpatialOrientationAdapter. As a simple example, 
I wrote the following code:

#include <iostream>
#include <itkSpatialOrientationAdapter.h>
#include <itkMatrix.h>
#include <itkImage.h>

int main( int argc, char* argv[] )
{
   typedef itk::Image< float , 3 > ImageType ;
   typedef ImageType::DirectionType DirectionType ;
   DirectionType direction ;
   direction.SetIdentity() ;
   typedef itk::SpatialOrientation::ValidCoordinateOrientationFlags 
CoordinateOrientationCode ;
   CoordinateOrientationCode orientation ;
   orientation = itk::SpatialOrientationAdapter().FromDirectionCosines( 
direction ) ;
   if( orientation == 
itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_LPS )
   {
      std::cout <<  "LPS" << std::endl ;
   }
   else if( orientation == 
itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RAI )
   {
      std::cout <<  "RAI" << std::endl ;
   }
   else
   {
      std::cout <<  "Unknown" << std::endl ;
   }
   return 0 ;
}

I wanted to make sure that since ITK is using LPS as its default 
orientation, if I were to give the identity matrix as an orientation 
matrix to itk::SpatialOrientationAdapter().FromDirectionCosines, I would 
obtain LPS as a result. However, I obtain RAI which is exactly the 
opposite of what I was expecting. Could somebody help me to understand 
what is happening and why I don't get LPS as a result?
Thank you,

Francois


More information about the Insight-users mailing list