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

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Tue Nov 1 16:40:06 EST 2005


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<TMaskImage *>( mask ));
  }

  const TMaskImage* GetMaskImage() const {
    return (static_cast<const TMaskImage*>(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 !


More information about the Insight-users mailing list