[Insight-users] using the itk::ResampleImageFilter with deformation fields

Lars Friedrich lars-friedrich at gmx.net
Wed Feb 27 08:58:00 EST 2008


Hello ITK-users,

I try to use the itk::ResampleImageFilter with deformation fields where 
the deformation field type is defined as follows:
enum{Dimension2D = 2, Dimension = 3};
typedef itk::Vector< float, Dimension > VectorType;
typedef itk::Image< VectorType, Dimension > DefFieldType;
typedef DefFieldType::Pointer DefFieldPointer;

Then I try to transform (itk::Euler3DTransform<float>) this deformation 
field using the itk::ResampleImageFilter:

typedef typename itk::ResampleImageFilter<ImgTp, ImgTp, float> 
ResampleFilterType;
typedef typename itk::LinearInterpolateImageFunction <ImgTp, float> 
InterpolatorType;
if (transform)
{ typename ResampleFilterType::Pointer resampler = 
ResampleFilterType::New();
typename InterpolatorType::Pointer interpolator = InterpolatorType::New();

resampler->SetInput(img);
resampler->SetTransform(transform);
resampler->SetInterpolator(interpolator);

resampler->SetUseReferenceImage(true);
resampler->SetReferenceImage(img);
resampler->SetDefaultPixelValue(defaultPixelValue);

img = resampler->GetOutput();
resampler->Update();
}

Unfortunately this code cannot be compiled. Various error messages are 
displayed, e.g. 
"htToolkit-src/Insight/Code/BasicFilters/itkResampleImageFilter.txx:238: 
error: ‘NonpositiveMin’ is not a member of 
‘itk::NumericTraits<itk::Vector<float, 3u> >’".
Obviously the used PixelType (the 3D vector) does not provide the needed 
operators/methods used by ResampleImageFilter.

Can anyone tell me another way to transform a deformation field with 3D 
vector pixel type? Or do I have to decompose deformation field, 
transform the dimensions separately and then merge them again into one 
deformation field?

regards,
Lars


More information about the Insight-users mailing list