[ITK-users] GetOrigin of an itk image

Zein Salah zeinsalah at gmail.com
Mon Dec 8 08:20:29 EST 2014


Hi,

To saome reason I don't know, I fail to get the origin of itk images.
The following simple code prints the spacing. for the origin, it always
prints 0,0,0.

    typedef itk::Image<short, 3>            ImageType;
    ImageType::SpacingType spacing = image->GetSpacing();
    ImageType::PointType origin = image->GetOrigin();
    printf("Spacing: %f %f %f\n", spacing[0], spacing[1], spacing[2]);
    printf("Origin: %f %f %f\n", origin[0], origin[1], origin[2]);

The values of the Offset field in the Header og the input file (mhd)
are definitely not zero.

Was this the right way to read out the origin? o I am missing something?

thanks

zein


More information about the Insight-users mailing list