[Insight-users] how to write a filter with 2 inputs

Renaud Isabelle renauisa at yahoo.fr
Tue Nov 1 18:19:36 EST 2005


Hi, 
 
yes, it is to apply on 2 inputs of the same type: more precisely, on two slices of one image 3D. So, what you mean is that I just have to derive my own filter from itkImageToImageFilter and just modify the constructor of it. 
 
Can you give me some filters builded like this? 
 
- Moreover, I would like to implement a pixel-wise function as well as functions on the overall of my 2 inputs. But, after a first sight on itkBinaryFunctorImageFilter, it seems that a pixel wise function required to be defined in a ThreadedGenerateData function whereas my operations on the overall input images need GenerateData function, right?
 
ISabelle

Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr> a écrit :

Hi Isabelle,

There is lots of filters with 2 inputs. If you want to have 2 inputs of same 
type, you just have to declare it in the constructor with :

this->SetNumberOfRequiredInputs(2);

If the 2 image can be of different types, it's a little more complex. You 
should look at ConnectedComponentImageFilter which do that. Here is the 
relevant part of code in the header :

void SetMaskImage(TMaskImage* mask) {
this->SetNthInput(1, const_cast( mask ));
}

const TMaskImage* GetMaskImage() const {
return (static_cast(this->ProcessObject::GetInput(1)));
}

Regards,

Gaetan

On Tuesday 01 November 2005 22:33, Renaud Isabelle wrote:
> Hi,
>
> I am triing to write a filter that will have two inputs and one output.
>
> The only example that I found with two inputs is
> itkBinaryFunctorImageFilter. However, my filter will not compute a
> pixel-wise operation.
>
> I am looking for a file like itkImageToImageFilter but with 2 inputs. Then,
> I could derive my own filter from it.
>
> Any example or any idea to give, please?
>
> Isabelle
>
>
>
>
>
>
> ---------------------------------
> Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
> Téléchargez le ici !


		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051102/04239853/attachment.html


More information about the Insight-users mailing list