[Insight-users] BinaryFunctorNeighborhoodImageFilter ?

Miller, James V (Research) millerjv at crd.ge.com
Mon Mar 14 10:08:39 EST 2005


You can certainly derive a filter from BinaryFunctorImageFilter to 
do what you want.  You will need to override the following methods from
the superclass (or its superclass):

ThreadedGenerateData() - since your filter needs to compute over neighborhoods, you will have to provide your own ThreadedGenerateData() that will iterate
over the neighborhoods.  The loops will be similar to the NoiseImageFilter.

GenerateInputRequestedRegion() - since your filter needs to compute over 
neighborhoods, you will have to provide this method to pad the output
requested region by the radii of the neighborhood and crop the region with 
the largest possible region.

About all that your will gain from deriving from BinaryFunctorImageFilter
are SetInput1() and SetInput2().


-----Original Message-----
From: insight-users-bounces at itk.org
[mailto:insight-users-bounces at itk.org]On Behalf Of Jordi Inglada
Sent: Monday, March 14, 2005 6:51 AM
To: Miller, James V (Research)
Cc: insight-users at itk.org
Subject: Re: [Insight-users] BinaryFunctorNeighborhoodImageFilter ?


Thanks for your answer. It wasn't clear from my message, but my idea in 
deriving a class from the BinaryFunctorImageFilter was being able to 
change the processing strategy by  using  the functor template.


Miller, James V (Research) wrote:

>I would just make a filter that subclasses from ImageToImageFilter.
>You can write a GenerateData() or ThreadedGenerateData() method
>to implement your algorithm.  You'll just need two neighborhood 
>iterators, one for each input image.
>You should also provided a GenerateInputRequestedRegion() method
>that takes the output requested region and pads it by the radius
>of the neighborhood for your computation.  That way if a user 
>streams data through your filter, you will not have an artificial
>boundary condition.
>A filter like the Code/BasicFilters/itkNoiseImageFilter might be 
>a good place to start.  It has a fairly clean implementation of 
>using neighorhood iterators to calculate the standard deviation
>of pixel values in a neighborhood about each pixel.  For your 
>case, you will have two neighborhood iterators and will have to 
>modify the GenerateInputRequestedRegion() to calculate the input
>requested region for both of your inputs.  You'll also need to 
>add methods to set the second input.
>-----Original Message-----
>From: insight-users-bounces at itk.org
>[mailto:insight-users-bounces at itk.org]On Behalf Of Jordi Inglada
>Sent: Thursday, March 10, 2005 10:38 AM
>To: insight-users at itk.org
>Subject: [Insight-users] BinaryFunctorNeighborhoodImageFilter ?
>Hi all,
>I want to implement a filter which produces an output whose pixels are 
>computed from 2 input images. The computation is not made pixel-wise, 
>but by combining the neighborhoods of the homologous pixels of the 2 
>input images.
>As far as I understand, the BinaryFunctorImageFilter is not appropriate 
>for this task since the functor used takes pixel values as input instead 
>of neighborhoods.
> Actually, I would need to replace the ImageRegionConstIterators for the 
>input images by ConstNeighborhoodIterators in the ThreadedGenerateData 
>of the BinaryFunctorImageFilter.
>Does this kind of filter already exist in Itk?
>Or should I create som kind of BinaryFunctorNeighborhoodImageFilter?

18, avenue Edouard Belin
31401 Toulouse Cedex 09 - France
Tel. +33.(0) - Fax. +33.(0)

Insight-users mailing list
Insight-users at itk.org

More information about the Insight-users mailing list