[Insight-users] Problem with the warp image filter

Merrem, Andreas andreas.merrem at medma.uni-heidelberg.de
Wed Jun 9 14:27:09 EDT 2010


Hi Luis (I'm very happy about help from anyone who has an idea),

Thanks a lot for your previous help. 
I have tried to use the itk::WarpImageFilter on a 3D DICOM volume with
origin [-199.071, 3.32761, 170.176] and spacing [1.5626, 1.5625, 4]. For
testing, I used a deformation field filled with zero vectors to output
the same image I put in.

It works perfectly for 2D png images with spacing [1,1] and origin
[0,0]. However, when I try to warp the dicom volume with the exact same
procedure, the resampled image contains only pixel values of 0. In both
cases, I set the origin and spacing of the deformation field and of the
output image equal to those of the input image. 

I have no idea what causes this problem, and I have verified that it has
nothing to do with reading or writing the image files.     

I set up the filter in the following way:


typedef itk::WarpImageFilter <ImageType, ImageType,
DeformationFieldType>ResamplerType;
typedef itk::LinearInterpolateImageFunction <ImageType, double>
LinearInterpolatorType;

LinearInterpolatorType::Pointer LinearInterpolator =
LinearInterpolatorType::New();
ResamplerType::Pointer resampler = ResamplerType::New(); 
ImageType::Pointer ResampledImage = ImageType::New(); 

resampler-> SetInterpolator(LinearInterpolator);
resampler-> SetOutputSpacing (InputImage->GetSpacing());
resampler-> SetOutputOrigin (InputImage->GetOrigin());
resampler-> SetDeformationField (DeformationField);  
resampler-> SetInput (InputImage);
resampler-> Update();

ResampledImage = resampler-> GetOutput();

This is really a bit mysterious to me, so if you see what I am missing,
that would be very helpful. 
  
Best regards, 

Andreas


More information about the Insight-users mailing list