[Insight-developers] ResampleImageFilter::SetReferenceImage problem

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Sep 14 12:55:38 EDT 2011


On Sep 14, 2011, at 12:50 PM, M Stauffer (V) wrote:

> 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? 

Need needs to be done this way so that both images are updated during the pipeline execution.

> 
> 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.
> 

I think this is the bug here. This filter does not need to verify that the 2 inputs are in the same physical space. VerifyInputInformation should be overloaded.


> 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
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110914/ed455eb5/attachment.htm>


More information about the Insight-developers mailing list