[Insight-developers] ResampleImageFilter::SetReferenceImage problem

M Stauffer (V) mstauff at verizon.net
Wed Sep 14 12:50:19 EDT 2011


Hi,

I think there's a problem with ResampleImageFilter::SetReferenceImage.
The reference image is used to set the output image image information.
It's storing the reference image in the array of image inputs like so:

ResampleImageFilter< TInputImage, TOutputImage,
TInterpolatorPrecisionType >
::SetReferenceImage(const TOutputImage *image)
{
  itkDebugMacro("setting input ReferenceImage to " << image);
  if ( image != static_cast< const TOutputImage * >(
this->ProcessObject::GetInput(1) ) )
    {
    this->ProcessObject::SetNthInput( 1, const_cast< TOutputImage * >(
image ) );
    this->Modified();
    }
}

I can't see why this is done like this. The ResampleImageFilter only
uses a single input, so maybe this was done for convenience of some
kind? 

The problem is that when you set a reference image that is in a
different image space than the input image,
ImageToImageFilter::VerifyInputInformation fails. The code that stores
the reference image as an input image predates the addition of the
VerifyInputInformation method.

Am I missing something else about the use of a reference image within
the input image list that makes it meaningful?

I can get around this currently by using
ResampleImageFilter::SetOutputParametersFromImage instead of
SetReferenceImage.

-M



More information about the Insight-developers mailing list