[vtkusers] Getting Image Information HELP !!!!!!!!!!!
Mathieu Malaterre
mathieu.malaterre at kitware.com
Tue Jan 20 10:35:48 EST 2004
Yi-Yu,
Two things:
- VTK is command driven you *should* call 'Update' on any filter to make
sure the info are accurate.
- VTK has recently made a big change, API went from float to double:
http://public.kitware.com/cgi-bin/vtkfaq?req=show&file=faq06.011.htp
[- convert APIs to double]
HTH
Mathieu
Yi-Yu Chou wrote:
> Dear all,
>
> I tried to get image information from a vtkImageData in C++, but I got
> some problems !!!
> For example, I tried method 1 to get the voxel spacing double *spc;
> spc = img->GetSpacing();
> I got the following error :
> cannot convert `float*' to `double*' in assignment
>
> I tried method 2:
> double spc[3];
> img->GetSpacing(spc);
> The error is :
> no matching function for call to `vtkImageData::GetSpacing(double[3])'
> /usr/local/include/vtk/vtkImageData.h:250: candidates are: virtual float*
> vtkImageData::GetSpacing()
> /usr/local/include/vtk/vtkImageData.h:250: virtual void
> vtkImageData::GetSpacing(float&, float&, float&)
> /usr/local/include/vtk/vtkImageData.h:250: virtual
> voidhttp://by8fd.bay8.hotmail.msn.com/cgi-bin/compose?&curmbox=F000000001&a=90fc86e5b2e5469318f74d6a10d7ac9d#
>
>
> vtkImageData::GetSpacing(float*)
>
> I tried method 3:
> float spc[3];
> img->GetSpacing(spc);
> I got : 0 956648974 -2147483648
> It's not correct, and the correct value should be 1 1 1.5
>
> However, you can find that the method 1 is used in vtkImageSobel3D.cxx
> and method 2 is used in vtkImageResample.cxx. Why can't I use them ? And
> why the the method 3 can't get the correct value ?Please tell me what's
> wrong with my code !!!!!!!!!
> Thanks a lot !!!!
>
> _________________________________________________________________
> 來逛逛 MSN eShop:便利的購物環境、優質的網路商家,隨時有驚喜的優惠促銷等
> 著您
> ! http://msn.com.tw/eshop
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list