[Insight-users] ImageIOBase::GetSpacing

Luis Ibanez luis.ibanez@kitware.com
Mon, 09 Dec 2002 08:43:14 -0500


Hi Samuel,


When you call

     reader->GetOutput()->GetSpacing()

you are invoking the GetSpacing() method of the
itk::Image. This method is defined in the base
class itk::ImageBase.

http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageBase.html

The signature is:

   virtual const double* GetSpacing() const;


you may want to do something like:

  const double mySpacing =3D reader->GetOutput()->GetSpacing();

mySpacing will be pointing to an array of N doubles
assciated with the spacings.  N=3D image dimension.


Please take a look at the example:


    Insight/Examples/DataRepresentation/Image/

         Image4.cxx


Let us know if you have further questions.


   Thanks

    Luis


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Samuel Rodr=EDguez Bescos wrote:

> Hello to all,
>=20
> =20
>=20
> I want to know the spacing attributes of and image for make a mesh=20
> resulting of the deformable model 3D Segmentation and I need knowing=20
> that parameters for visualizate the resulted mesh.
>=20
> =20
>=20
> I do it with the next code:
>=20
> =20
>=20
>  double scaleX=3D m_Reader->GetOutput()->GetSpacing(0);
>  double scaleY=3Dm_Reader->GetOutput()->GetSpacing(1);
>  double scaleZ=3D m_Reader->GetOutput()->GetSpacing(2);
>=20
> =20
>=20
> But the are the next error message doing the compilation process:
>=20
>=20
> error C2660: 'GetSpacing' : function does not take 1 parameters.
>=20
> =20
>=20
> Has anybody any Idea about how is used the function GetSpacing.
>=20
> =20
>=20
> The interface is
>=20
> =20
>=20
> virtual double  GetSpacing=20
> <http://www.itk.org/Doxygen10/html/classitk_1_1ImageIOBase.html#z888_1>=
=20
> (unsigned int i) const
>=20
> =20
>=20
> Thanks,
>=20
> =20
>=20
> Sam
>=20
> =20
>=20
> =20
>=20
> =20
>=20
>=20