[Insight-users] Interpolation and resampling templates

Emmanuel Christophe emmanuel.christophe at gmail.com
Wed Mar 4 23:57:15 EST 2009


Hi again,

Attached is a patch to solve these issues (see below) with the
itkResampleImageFilter and the itkOptResampleImageFilter. They can now
be applied to itk::Image<std::complex<double>,2>. I believe that it is
also a step in the right direction to apply them to itk::VectorImage
(but I did not have the time to tried). The patch is to be applied
against the CVS version.

This does not modify the previous behavior with scalar pixels or the
filter interface. All itk tests (including Examples) still pass with
the ITK_USE_OPTIMIZED_REGISTRATION and the ITK_USE_REVIEW options ON
or OFF.

Best regards,
Emmanuel


2009/3/2 Emmanuel Christophe <emmanuel.christophe at gmail.com>:
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: itk-patch-resampling.patch
Type: text/x-patch
Size: 17025 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090305/b61dbf7f/attachment.bin>


More information about the Insight-users mailing list