[Insight-developers] Unary, Binary, Ternary, Nary Filters

Luis Ibanez ibanez@choroid.cs.unc.edu
Wed, 26 Sep 2001 11:37:54 -0400 (EDT)


Jim,


Yeap,
the names are inconsistent, I was trying to avoid
ambiguities with the use of "Binary".

Currently "Binary" is being used for two very
different things:

- Mathematical morphology filters over binary images
- Filters accepting two inputs (binary operators).


"BinaryImageFilter" was intended to mean:
"filter with two inputs", but can easily be
taken as "filter over binary images".

---

Adding "Functor" to the base classes seems reasonable,
that will invite users to read the doc before assuming
that "Binary" is related to binary images.


So, just to double-check before renaming all these classes
as well as their test files in Testing/Code/BasicFilters


1) {Unary,Binary,Ternary,Nary}ImageFilter will be
   renamed as {Unary,Binary,Ternary,Nary}FunctorImageFilter.

2) Filters deriving from UnaryFunctorImageFilter
   will only have the name of the function:

   itkSinImageFilter, itkSqrtImageFilter

3) Filters deriving from BinaryFunctorImageFilter
   will only have the name of the operator:

   itkAddImageFilter
   itkMultiplyImageFilter


4) Filters deriving from TernaryFunctorImageFilter
   will have "Ternary" and the name of the function

   itkTernaryMagnitudeImageFilter
   itkTernaryAddImageFilter

5) Filters deriving from NaryFunctorImageFilter
   will have "Nary" and the name of the function

   itkNaryAddImageFilter
   itkNaryMultiplyImageFilter



I guess it would be better to finish first the
modifications indicated in the spreadsheet (code
walkthrough) before renaming a lot of classes...

Is that OK ?

---

BTW when I've renamed classes I'm cvs removing the
old one and cvs adding the new one, but that would
probably lost track of the cvs history linking both
classes. Is there a better way to rename classes and
maybe conserve their log history ?


Thanks,

Luis





-----------------------------

On Wed, 26 Sep 2001, Miller, James V (CRD) wrote:

> Luis,
>
> The Nary filter looks fine.  However, you need to modify the documentation for the new AddImageFilter
> to reflect the changes.
>
> As for the names,  I think you've introduce two inconsistencies.
>
> First: If the superclass of Add2ImageFilter is BinaryImageFilter, then you are being inconsistent on
> when you use "2" and when you use "Binary" to indicate that there are more than one input. Also, I
> would probably use "Two" instead of "2".
>
> Second: If the superclass of AddImageFilter is NaryImageFilter, this is inconsistent from the
> SubtractImageFilter, MultiplyImageFilter, etc. which derive from BinaryImageFilter.
>
> What if the superclasses were (added the Functor word to each)
>
> UnaryFunctorImageFilter
> BinaryFunctorImageFilter
> TernaryFunctorImageFilter
> NaryFunctorImageFilter
>
> and the subclasses were:
>
> SinImageFilter  (same as before)
> AddImageFilter  (this is the old binary add version)
> NaryAddImageFilter
> NaryMultiplyImageFilter
>