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

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Nov 2 08:55:31 EST 2005


On Wed, 02 Nov 2005 13:27:52 +0100, Renaud Isabelle <renauisa at yahoo.fr>  
wrote:

> Hi again,
> Of course. What I would like to do is computing an output image from 2  
> input images: the output image is the correlation matrix of the 2 input  
> images computing through FFT. So, my operations on the overall image is  
> to compute the FFT of each input image, my pixel wise operation is to  
> compute the pixel wise multiplication of each complex FFT of the input  
> images.
> Isabelle

So you should create a filter which use some other filters. in the  
GenerateData method, you create a mini pipeline which do the computations  
you want and pass the result as output of your image. Look at  
http://www.itk.org/Doxygen/html/classitk_1_1HConvexImageFilter.html for an  
example.

>
> Gaetan Lehmann <gaetan.lehmann at jouy.inra.fr> a écrit :
> On Wed, 02 Nov 2 o005 00:18:47 +0100, Renaud Isabelle
> wrote:
>
>> 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.
>
> That's it :-)
>
>> Can you give me some filters builded like this?
>
> http://www.itk.org/Doxygen/html/classitk_1_1ReconstructionByDilationImageFilter.html
> http://www.itk.org/Doxygen/html/classitk_1_1MaskImageFilter.html
> ...
>
>> - 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?
>
> What do you mean by "operations on the overall input images" ?
> Do you want to compute an output image ? Or a single value ?
> Can you give more precision about what you want to do ?
>
>> ISabelle
>>
>> Gaetan Lehmann 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 !
>
>
>



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-users mailing list