[Insight-developers] InPlaceImageFilter::CanRunInPlace not virtual + Potential misunderstanding with InPlaceImageFilter::GetInplace

Tom Vercauteren tom.vercauteren at m4x.org
Wed Apr 29 07:52:32 EDT 2009


Hi all,

I wrote a subclass of InPlaceImageFilter. Because of  the following
(now fixed) bug, http://www.itk.org/Bug/view.php?id=8672, my filter
can only run in place for ITK version strictly greater than 3.12. I
thus need a backward compatibility scheme.

My first try, was to override InPlaceImageFilter::CanRunInPlace to
return false if the ITK version is below 3.13. However I realized that
InPlaceImageFilter::CanRunInPlace is not virtual which means I'd
rather stay off overriding it... Is there a reason why
InPlaceImageFilter::CanRunInPlace is not virtual?

Also, I initially thought that, if InPlaceImageFilter::CanRunInPlace
returned false, then InPlaceImageFilter::GetInplace would also return
false. This is however not the case. It seems that I need to both
check for CanRunInPlace and GetInplace to know whether a filter will
actually run in place.

This design seems a bit odd to me. Wouldn't it be better if
InPlaceImageFilter::GetInplace would return whether a filter will
actually run in place? Or maybe we can add a new virtual function to
do that, e.g. InPlaceImageFilter::WillRunInPlace.

Currently, it seems that such a function would only be used in three
itk classes ( PasteImageFilter, CastImageFilter and
DenseFiniteDifferenceImageFilter) but I think it would be worth having
it.

Thoughts?

Regards,
Tom Vercauteren


More information about the Insight-developers mailing list