[Insight-developers] RE: Insight code walkthrough

Miller, James V (CRD) millerjv@crd.ge.com
Wed, 26 Sep 2001 07:56:17 -0400


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






-----Original Message-----
From: Luis Ibanez [mailto:ibanez@choroid.cs.unc.edu]
Sent: Tuesday, September 25, 2001 6:02 PM
To: Miller, James V (CRD)
Cc: Will Schroeder; Insight-developers (E-mail)
Subject: Re: [Insight-developers] RE: Insight code walkthrough



Jim,

Ok,
I agree with you in that it is better to have a
separate Add filter for multiple inputs.

So, an itkNaryImageFilter was introduced in order to manage
any number of inputs and apply the same operation to all
of them in order to produce the output. This is the Nth
equivalent of the BinaryImageFilter or the UnaryImageFilter.
All the input images are assumed to be of the same type.

Deriving from it, an itkAddImageFilter was added, and the
previous one (the binary) was renamed itkAdd2ImageFilter.

itkAdd2ImageFilter should be much more efficient, so it
should be prefered for the specific case of 2 inputs.

---

Streaming seems to be ok, but
with respect to multithreading I'm not that sure,
If you have a chance, could you please take a look at
it and verify that things are well configured ?

Thanks

Luis

-------

On Tue, 25 Sep 2001, Miller, James V (CRD) wrote:

> Luis,
>
> Will and I went through your modifications yesterday. The spreadsheet has been updated.
>
> One point: You indicated that the AddImageFilter couldn't be set up to handle an arbitrary number
of
> inputs because you have to do a
>
> foreach image
> 	foreach pixel in region
> 		accumulate pixel
>
> and you felt that this would not stream.  In actually, this would stream very nicely.  The output
> requested region would propagate to all the inputs (all inputs would have the same requested
region).
> So each input would have the same "stream" region to operate on.
>
> Now, due to templating, we might want to have a separate filter for such an operation that would
> force all the input images to be the same "type". So there would only be a single input image
> template parameter and a single output image template parameter.
>