[Insight-users] Default orientation of an Analyze image
Luis Ibanez
luis.ibanez at kitware.com
Sat Aug 15 22:13:20 EDT 2009
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/<http://www.robots.ox.ac.uk/%7Ewenjia/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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090815/7be31971/attachment.htm>
More information about the Insight-users
mailing list