[vtkusers] Getting Image Information HELP !!!!!!!!!!!

Yi-Yu Chou chouyiyu at hotmail.com
Tue Jan 20 10:28:29 EST 2004


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 




More information about the vtkusers mailing list