[Insight-users] Wrong voxel size when using GetSpacing()

Jafari, Kourosh kjafari at rad.hfh.edu
Sun Nov 28 23:59:02 EST 2010


Hello,

I use itk::ImageFileReader to read a 3-D cone beam CT image in dicom format (in a single file) and I get wrong voxel size. The correct voxel size is 0.32x0.32x0.32 mm3 but it shows me a wrong voxel size of 1x1x0.32 mm3. MRIcro reads and displays the file correctly. Can anyone help?

Here are few lines of the code I use to display the voxel size:

 typedef  short  int   PixelType;
 typedef itk::Image< PixelType, Dimension >  ImageType;
 typedef itk::ImageFileReader< ImageType  > ImageReaderType;

 ImageReaderType::Pointer ImageReader = ImageReaderType::New();
 ImageType::Pointer image = ImageReader->GetOutput();

 const ImageType::SpacingType& Size =image->GetSpacing();
 std::cout << Size.GetElement(0)<< std::endl;
 std::cout << Size.GetElement(1) << std::endl;
 std::cout << Size.GetElement(2) << std::endl;

Thanks,
Kourosh


More information about the Insight-users mailing list