[Insight-users] Problem: ResampleImageFilter & WindowedSincInterpolateImageFunction

Derek Cool coold at email.unc.edu
Wed May 26 17:43:12 EDT 2004


Hi,
I found what I assume is a bug in ResampleImageFilter and a default
incompatibility between ResampleImageFilter and the
WindowedSincInterpolateImageFunction.

For the incompatibility, using the default template values for both classes
will not compile:

  typedef itk::ResampleImageFilter< InputImageType, InputImageType >
ResampleImageFilterType;
  ResampleImageFilterType::Pointer  filter = ResampleImageFilterType::New();
  filter->SetInput( image );

  typedef itk::WindowedSincInterpolateImageFunction<InputImageType,3>
InterpolateFunctionType;
  InterpolateFunctionType::Pointer interpolator =
InterpolateFunctionType::New();

  filter->SetInterpolator( interpolator );

  filter->Update();


This is because the sinc interpolator default type is not compatible with
the default InterpolatorType of the resampler.  Specifically the default
types for TInterpolatorPrecisionType are different between the classes.

=double for ResampleImageFilter
and
=float for WindowedSincInterpolateImageFunction (named TCoordRep in class
template)

When I explicitly set the WindowedSincInterpolateImageFunction
InterpolatorPrecisionType to double, then everything compiled fine (though I
have not tested it).  I don't know if the float is necessary for the
WindowedSincInterpolateImageFunction, but I think it would be nice to have
the defaults work together.

I then discovered the bug in ResampleImageFilter, when I tried to modify the
InterpolatorPrecisionType to float (or any type other than double) on the
ResampleImageFilter and I got the following errors:


c:\DevFiles\Insight\Code\BasicFilters\itkResampleImageFilter.txx(99) : error
C2664: 'itk::Point<TCoordRep,NPointDimension>::Point(const
itk::Point<TCoordRep,NPointDimension>::Self &)' : cannot convert parameter 1
from 'const double []' to 'const itk::Point<TCoordRep,NPointDimension>::Self
&'
        with
        [
            TCoordRep=float,
            NPointDimension=3
        ]
        and
        [
            TCoordRep=float,
            NPointDimension=3
        ]
        Reason: cannot convert from 'const double []' to 'const
itk::Point<TCoordRep,NPointDimension>::Self'
        with
        [
            TCoordRep=float,
            NPointDimension=3
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xmemory(156) : while compiling class-template member
function 'void
itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType
>::SetOutputOrigin(const double [])'
        with
        [
            TInputImage=InputImageType,
            TOutputImage=InputImageType,
            TInterpolatorPrecisionType=float
        ]
        \Derek\Programs\Development\AtlasCompare\AtlasCompareMain.cxx(33) :
see reference to class template instantiation
'itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionTyp
e>' being compiled
        with
        [
            TInputImage=InputImageType,
            TOutputImage=InputImageType,
            TInterpolatorPrecisionType=float
        ]
c:\DevFiles\Insight\Code\BasicFilters\itkResampleImageFilter.txx(259) :
error C2664: 'void itk::Image<TPixel,VImageDimension>::SetOrigin(const
itk::Image<TPixel,VImageDimension>::PointType)' : cannot convert parameter 1
from
'itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionTyp
e>::PointType' to 'const itk::Image<TPixel,VImageDimension>::PointType'
        with
        [
            TPixel=InputPixelType,
            VImageDimension=3
        ]
        and
        [
            TInputImage=InputImageType,
            TOutputImage=InputImageType,
            TInterpolatorPrecisionType=float
        ]
        and
        [
            TPixel=InputPixelType,
            VImageDimension=3
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xmemory(156) : while compiling class-template member
function 'void
itk::ResampleImageFilter<TInputImage,TOutputImage,TInterpolatorPrecisionType
>::GenerateOutputInformation(void)'
        with
        [
            TInputImage=InputImageType,
            TOutputImage=InputImageType,
            TInterpolatorPrecisionType=float
        ]

Please let me know if this is a bug and if you would like me to enter this
into the bug tracker or not.

Thanks,
Derek



More information about the Insight-users mailing list