[Insight-developers] Template parameters

Brad King brad.king@kitware.com
Thu, 1 Mar 2001 17:36:52 -0500 (EST)


Here is my view:

> template <class TPixel, unsigned int VDimension=2>
> class ITK_EXPORT NeighborhoodOperatorImageFilter :
>     public ImageToImageFilter< Image<TPixel, VDimension>,
>                                Image<TPixel, VDimension> > 
This version should never be used because it locks down the filter to
operating on the Image class directly.  This prevents someone from using
an image adaptor or writing their own image class that conforms to our
image's interface.

> template <class TInputImage, class TOutputImage>
> class ITK_EXPORT ShrinkImageFilter:
>     public ImageToImageFilter<TInputImage,TOutputImage>
This version should always be used.  Any type can be passed to each
parameter, so image adaptors and other image classes can be substituted
for our image.  Even when the image types must be the same for both input
and output, someone could still use an image adaptor on one end, and thus
we need two different template parameters.

> template <class TImage>
> class ITK_EXPORT ThresholdImageFilter:
>    public ImageToImageFilter<TImage,TImage>
This version should never be used due to the above argument about image
adaptors.  If you want to make sure the data and dimensions are the same
for the two images, there are other ways to do it at compile time.  I'll
try to come up with an example of this if someone needs to do it.

-Brad