[Insight-users] Image size is null

Sylvain Bernhardt sylvainb at ece.ubc.ca
Sun Feb 26 19:03:52 EST 2012


Hi David,
Thanks for the help.
Yes, I meant GetOutput(), but however I don't see the Update() method 
for the reader of class ImageFileReader.

S.

On 26/02/2012 3:52 PM, David Doria wrote:
> 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