Hi Michael,<br><br>You can do it directly as:<br>std::cout << image->GetLargestPossibleRegion().GetNumberOfPixels( ) << std::endl;<br><br>Kishore<br><br><br><br><div class="gmail_quote">On Tue, Feb 2, 2010 at 8:58 AM, michiel mentink <span dir="ltr"><<a href="mailto:michael.mentink@st-hughs.ox.ac.uk">michael.mentink@st-hughs.ox.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Thank you both, for future reference:<br><br> const ImageType::SizeType sizeOfImage = image->GetLargestPossibleRegion().GetSize();<br>
<br> std::cout << "Size ";<br> std::cout << sizeOfImage[0] << ", " << sizeOfImage[1] << ", " << sizeOfImage[2] << std::endl;<br>
<br><br>cheers, Michael<div><div></div><div class="h5"><br><br><br><br><div class="gmail_quote">On Tue, Feb 2, 2010 at 1:53 PM, <span dir="ltr"><<a href="mailto:M.Staring@lumc.nl" target="_blank">M.Staring@lumc.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Michael,<br>
<div><div></div><div><br>
> Is there some way of getting the number of pixels in X,Y,Z<br>
> from an ITK image?<br>
><br>
> There's methods in ITKImage for spacing, origin and<br>
> direction, but not for the amount of pixels.<br>
> Why is that?<br>
><br>
<br>
</div></div>There actually is, but it is somewhat hidden in the region:<br>
<br>
SizeType size = image->GetLargestPossibleRegion().GetSize();<br>
<br>
Cheers,<br>
<br>
Marius<br>
</blockquote></div><br>
</div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br>