[Insight-users] get dimensions of image volume

michiel mentink michael.mentink at st-hughs.ox.ac.uk
Tue Feb 2 08:58:36 EST 2010


Thank you both, for future reference:

 const ImageType::SizeType sizeOfImage =
image->GetLargestPossibleRegion().GetSize();

  std::cout << "Size ";
  std::cout << sizeOfImage[0] << ", " << sizeOfImage[1] << ", " <<
sizeOfImage[2] << std::endl;


cheers, Michael



On Tue, Feb 2, 2010 at 1:53 PM, <M.Staring at lumc.nl> wrote:

> Hi Michael,
>
> > Is there some way of getting the number of pixels in X,Y,Z
> > from an ITK image?
> >
> > There's methods in ITKImage for spacing, origin and
> > direction, but not for the amount of pixels.
> > Why is that?
> >
>
> There actually is, but it is somewhat hidden in the region:
>
> SizeType size = image->GetLargestPossibleRegion().GetSize();
>
> Cheers,
>
> Marius
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100202/19f46ac2/attachment.htm>


More information about the Insight-users mailing list