[Insight-users] Interpolation and resampling templates
Emmanuel Christophe
emmanuel.christophe at gmail.com
Mon Mar 2 00:50:04 EST 2009
Hi,
I'm having some trouble with the templates for the ResampleImageFilter
and the InterpolateImageFunction.
The ResampleImageFilter is defined as
template <class TInputImage, class TOutputImage,
class TInterpolatorPrecisionType=double>
class ITK_EXPORT ResampleImageFilter:
public ImageToImageFilter<TInputImage, TOutputImage>
In this definition TInterpolatorPrecisionType refers as the pixel
precision (Image::PixelType). The class description gives the example
of a labeled image where it is not desired to interpolate the values.
On the other hand, for the InterpolateImageFunction we have:
template <class TInputImage, class TCoordRep = double>
class ITK_EXPORT InterpolateImageFunction :
public ImageFunction< TInputImage,
ITK_TYPENAME NumericTraits<typename
TInputImage::PixelType>::RealType, TCoordRep >
Here the second template (TCoordRep) describes the precision of the
coordinates (hence, similar to the Image::PointType::ValueType).
However, in the definition of the ResampleImageFilter, there is the
following typedef:
typedef InterpolateImageFunction<InputImageType,
TInterpolatorPrecisionType> InterpolatorType;
Which assumes that the precision of the pixel value is the same as the
precision of the coordinates. I'm running into this problem when I'm
trying to interpolate complex images (PixelType is
std::complex<double> but the coordinate are obviously still double).
In the ResampleImageFilter filter, the same default for the coordinate
precision as in the itk::ImageBase could be assumed, replacing the
typedef by:
typedef InterpolateImageFunction<InputImageType, double> InterpolatorType;
or keeping the InterpolateImageFunction default:
typedef InterpolateImageFunction<InputImageType> InterpolatorType;
As the itk::Transform is templated over the coordinate precision also,
I assume the typedef of the TransformType should be corrected in the
same way.
Am I missing something here ?
Best regard,
Emmanuel
More information about the Insight-users
mailing list