[Insight-users] Get number of elements of a 3D image

David Doria daviddoria at gmail.com
Fri Jun 15 11:34:22 EDT 2012


On Fri, Jun 15, 2012 at 11:15 AM, Mr Francesco Grussu <
francesco.grussu at eecs.qmul.ac.uk> wrote:

> Dear all,
> could anybody suggest how to get the number of elements along the three
> directions of a 3D image?
>

If I understood your question correctly, I think you're looking for:

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

for(unsigned int i = 0; i < imageSize.GetSizeDimension(); ++i)
  cout << imageSize[i] << " ";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120615/46905bb0/attachment.htm>


More information about the Insight-users mailing list