[Insight-users] Print out the size of an image

Luis Ibanez luis.ibanez at kitware.com
Sun Oct 17 10:47:43 EDT 2010


Hi Xi,

Instead of:

vnl_vector<double> ImageSizeTempArray =
reader->GetOutput()->GetLargestPossibleRegion().GetSize();



You should use:

ImageType::SizeType  ImageSizeTempArray =
reader->GetOutput()->GetLargestPossibleRegion().GetSize();


     Regards,


          Luis


----------------------------------------
On Mon, Sep 27, 2010 at 4:54 AM, Xi Liang <liangxi1986317 at hotmail.com>wrote:

> Dear all,
>
> I would like to print out the size, origin, direction of an image and the
> parameters from bsplineTransform without bracket or comma. I want the
> parameters separated by space. I use the following code and it only works
> for the transformation parameter.
>
> vnl_vector<double> TempArray = bsplineTransform->GetParameters();
> vnl_vector<double> ImageSizeTempArray =
> reader->GetOutput()->GetLargestPossibleRegion().GetSize();
>
> The code in the first line gives me perfect format with parameters
> separated by space. However the second line give me the following error
> message:
>
> 1>..\CreateImageSetBspline.cxx(260) : error C2440: 'initializing' : cannot
> convert from 'const itk::Size<VDimension>' to 'vnl_vector<T>'
> 1>        with
> 1>        [
> 1>            VDimension=3
> 1>        ]
> 1>        and
> 1>        [
> 1>            T=double
> 1>        ]
> 1>        No constructor could take the source type, or constructor
> overload resolution was ambiguous
>
>
> Is there someone know the second line does not work? How can I print the
> size of an image such that parameters are separated by space? (Instead of
> using loop to print out all elements)
>
> Kind regards,
>
> Xo
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101017/1d96a825/attachment.htm>


More information about the Insight-users mailing list