[ITK] [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
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list