[Insight-developers] NeighborhoodFunctorImageFilter?
Brad King
brad.king at kitware.com
Fri, 09 Apr 2004 14:45:44 -0400
Hello,
While reading through the implementation of several filters like
GradientMagnitudeImageFilter and NeighborhoodOperatorImageFilter, I
noticed that the basic design of such filters follows a pattern. They
all have a ThreadedGenerateData that uses a face calculator and then
uses neighborhood iterators to iterate over the faces and perform some
calculation.
We should consider creating a general superclass template for all of
these filters called something like NeighborhoodFunctorImageFilter. It
would have a signature similar to UnaryFunctorImageFilter:
template <class TInputImage, class TOutputImage, class TFunction>
class NeighborhoodFunctorImageFilter;
This one tempalte would contain logic similar to the
NeighborhoodOperatorImageFilter, but instead of simply applying an
operator to each neighborhood, it would invoke the functor. Then all
these filters could be implemented with simple subclasses that create
the appropriate functor and instantiate this superclass template.
Comments?
-Brad