[Insight-users] itkCastImageFilter

Pieter Vos pieterv@radiology.azn.nl
Tue, 23 Apr 2002 16:46:37 +0200 (CEST)


Hello,

Somehow the itkCastImageFilter is capable of changing my deformable
mesh. After one iteration of the deformableMesh3DFilter the Z-coordinate
of the mesh is changed to a 'nan' (not a number)???
How could this be?

My input image is of float type which I read with a itkVTKImageIO and
Filereader.

  typedef itk::Image<float, myDimension>	inputImageType;
  typedef itk::Image<unsigned short, myDimension>  potentialImageType;

I would like to cast it to a unsigned short image, since the
itkDeformable3DFilter demands this type for the potential image (and the
output image) as well.
I use a float mesh:
  typedef itk::Mesh<float>   FMesh;
And the filter
  typedef itk::DeformableMesh3DFilter<FMesh, FMesh>  DFilter;

The strange thing is that I did an update with the CastImageFilter:

  typedef itk::CastImageFilter< inputImageType, potImageType>
myCasterType;

        myCasterType potCaster = myCasterType::New();
	potCaster->SetInput( potImgReader->GetOutput() );
	potCaster->Update();

And did not connect the output of the cast with the input (as a test) of
the deformable filter. In stead, I made two iterators and pasted all the
pixels to a copy img of type potImageType (like in the example
itkDeformable3DFilterTest, to go around the cast):

	itk::ImageRegionIteratorWithIndex <potImageType> ptit(potImg,
potRegion);
	itk::ImageRegionIteratorWithIndex<inputImageType> readerit
(potImgReader->GetOutput(), potRegion);
  ptit.Set((unsigned short) readerit.Get());
  deformablefilter->SetPotential( potImg )

So what is going on? I wrote the cast to a file and it seemed ok. How can
it be that the caster affects the deformable filter? 
May I assume that the caster works for 3D images?

Many thanks for the help!

-- 
Pieter Vos
UMC Radboud Nijmegen
The Netherlands
mailto:pieterv@radiology.azn.nl