[ITK] GetOrigin of an itk image

Bill Lorensen bill.lorensen at gmail.com
Mon Dec 8 08:25:11 EST 2014


That is correct. What does the rest of your code look like? Have you
done an Update() on the reader?


On Mon, Dec 8, 2014 at 8:20 AM, Zein Salah <zeinsalah at gmail.com> wrote:
> 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
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the Community mailing list