[Insight-users] Default orientation of an Analyze image

wenjia wenjia at robots.ox.ac.uk
Sun Aug 16 08:45:23 EDT 2009


Hi Luis,

I have not noticed the orientation problem before and written a lot of programs assuming the default direction to be identity. These programs work fine in ITK 3.8. However, after upgrading to ITK 3.14, a lot of programs function abnormally because itkImageBase starts using orientation information in conversion between index and physical point and the Analyze image has a non-identity direction.

Is it possible to disable the default orientation of AnalyzeImageIO by setting ITK_USE_ORIENTED_IMAGE_DIRECTION=OFF when installing ITK 3.14? 

Many thanks,
Wenjia

On 15 Aug 22:13, Luis Ibanez wrote:
> 
> Hi Wenjia,
> 
> 
> Yes,
> this is the default orientation for Analyze images.
> 
> 
>    Regards
> 
> 
>        Luis
> 
> 
> ---------------------------
> On Sat, Aug 15, 2009 at 10:15 AM, wenjia <wenjia at robots.ox.ac.uk> wrote:
> 
>     Dear all,
> 
>     I have just found that when ITK reads an Analyze image with unknown
>     orientation, it does not set the default image direction to identity.
>     Instead, it sets the direction to
> 
>      [1 0 0
>      0 0 -1
>      0 1 0].
> 
>     I am wondering why it uses this direction as default. Is this direction
>     defined in any Analyze format standard? Is it possible to change the
>     default to an identity matrix since it is easy to cope with?
> 
>     I have put a test Analyze file on the website: http://www.robots.ox.ac.uk/
>     ~wenjia/data/
> 
>     In addition, my ITK version is 3.14. I am using the following code for
>     reading the direction,
> 
>     #include "itkImage.h"
>     #include "itkImageFileReader.h"
> 
>     int main(int argc, char *argv[])
>     {
>      // Check the number of input arguments
>      if(argc < 2){
>        std::cout << "Read an image and show its direction" << std::endl;
>        std::cout << "Usage: " << argv[0] << " image" << std::endl;
>        return -1;
>      }
> 
>      const char *filename = argv[1];
> 
>      // Read the image
>      const unsigned int Dimension = 3;
>      typedef double InternalPixelType;
>      typedef itk::Image<InternalPixelType, Dimension> ImageType;
>      typedef itk::ImageFileReader<ImageType> ImageReaderType;
> 
>      ImageReaderType::Pointer reader = ImageReaderType::New();
>      reader->SetFileName(filename);
>      reader->Update();
>      ImageType::Pointer image = reader->GetOutput();
> 
>      // Show the direction
>      std::cout << "The image direction is:" << std::endl;
>      std::cout << image->GetDirection() << std::endl;
> 
>      return 0;
>     }
> 
> 
>     Many thanks,
>     Wenjia
>     --
>     Wenjia Bai
>     D.Phil Student
>     Wolfson Medical Vision Laboratory
>     Department of Engineering
>     University of Oxford
>     _____________________________________
>     Powered by www.kitware.com
> 
>     Visit other Kitware open-source projects at
>     http://www.kitware.com/opensource/opensource.html
> 
>     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://www.itk.org/mailman/listinfo/insight-users
> 
> 


More information about the Insight-users mailing list