[Insight-users] Bug in itkUnaryFunctorImageFilter

Koen Van Leemput koen . vanleemput at hus . fi
Fri, 16 May 2003 11:52:45 +0300


Hi,

itkUnaryFunctorImageFilter overrides itkProcessObject's default implementation 
of GenerateOutputInformation(), but fails to call 
Superclass::GenerateOutputInformation() prior to changing the information 
values it needs. While the comments in itkUnaryFunctorImageFilter.txx 
indicate that this behavior is intentional, it's actually a bug since the 
information values of subclasses of itkImage don't get copied as they should. 
Indeed, such subclasses may have their own additional information and the 
corresponding implementation of CopyInformation() to push this information 
through the ITK pipeline. However, itkUnaryFunctorImageFilter only handles 
Spacing and Origin, and never calls the CopyInformation() method of its 
output image.

It appears that the reason for not calling the superclass' implementation of 
GenerateOutputInformation(), is that itkImageBase and itkImage will throw 
exceptions if the input image and output image of itkUnaryFunctorImageFilter 
have different dimensions. So IMHO, itkUnaryFunctorImageFilter should either 
catch this exception, or then itkImageBase and itkImage should not throw 
exceptions at all...

- Koen