[Insight-users] Image size is null
David Doria
daviddoria at gmail.com
Sun Feb 26 18:52:29 EST 2012
On Sun, Feb 26, 2012 at 6:40 PM, Sylvain Bernhardt <sylvainb at ece.ubc.ca> wrote:
> Hi all,
> I would like to retrieve the size of a 2D image as follow:
>
> ImageType::Pointer img = somereader->GetImage();
> itk::Size<2> imgSize = img->GetLargestPossibleRegion().GetSize();
>
> But during the debug in VisualStudio, imgSize[0] and imgSize[1] appears to
> be null. Same if I do a std::cout.
> However, I know the image is well read as it is correctly displayed later on
> in the code with a itkImageToVTKImageFilter.
>
> Thanks for helping me out,
> S.
Try calling reader->Update() before you GetOutput() (you said
GetImage, but I assume you meant GetOutput() ?).
David
More information about the Insight-users
mailing list