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

Luis Ibanez luis.ibanez at kitware.com
Wed Dec 1 21:40:43 EST 2010


Hi Jafari,

Please do the following:

1) Run the executable

      DicomImageReadPrintTags

and give your filename as argument,

2) Let us know what output you get.


BTW: In your code example below,
the calls to reader->Update()  and
reader->SetFileName() seem to be
missing.


    Thanks


          Luis


--------------------------------
On Sun, Nov 28, 2010 at 11:59 PM, Jafari, Kourosh <kjafari at rad.hfh.edu> wrote:
> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list