[Insight-users] Constructing a filter with multiple inputs / outputs

Miller, James V (GE, Research) millerjv at crd.ge.com
Wed Jul 12 18:20:33 EDT 2006


Any ITK filter can have multiple inputs and outputs.  The are many examples of such filters in the toolkit. The constructor for your filter will need to specify the number of required inputs and create any outputs above the standard single output.  You will need to provide an implementation of MakeOutput() if the outputs can be different types.  You will not need to change anything at the ImageToImageFilter level.  You probably will need to create your own versions of the DiscreteGaussianImageFilter and the NeighborhoodOperatorImageFilter to accommodate the weights.  These new versions could be subclasses of the current DiscreteGaussian and NeighborhoodOperator filters or parallel classes.
 
Jim

-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of Avner MOSHKOVITZ
Sent: Wednesday, July 12, 2006 3:17 PM
To: insight-users at itk.org
Subject: [Insight-users] Constructing a filter with multiple inputs / outputs


Hi,
 
Still waiting for an answer...
Is there a way to handle multiple inputs/outputs within a filter?
 

The input image contains pixels with invalid values, which need to be ignored during the filtering. Therefore, the itkDiscreteGaussian filter needs to be applied selectively only to valid pixels.
To do that, during smartInnerProduct, the kernel weights are accumulated. In the regular case the kernel weights sum up to 1.0 but in this case the kernel weights sum up to a number smaller than 1.0 which are kept in a weight image (after the filtering ends, the final weight image is used to normalize the result value for the filtered pixels).
 
So, I'm looking for a way to introduce an input weight image and an output weight image to the filter as additional input/output to the input image and the filtered image.
The output weight image from each filter (I'm using to two filters, one for each dimension) should be fed as input to the next filter, in the same way as the chaining of the images.
 
In the construction of the itkDiscreteGaussianFilter the input/output images are penetrated to the base classes (NeighborhoodOperatorImageFilterWithWeight, ImageToImageFilter).
 
My question is, how should I introduce the weight images as additional input/output without having to change the code in the base classes?
 
Thanks,
Avner
 
 
 
 
  _____  

From: Avner MOSHKOVITZ 
Sent: Thursday, July 06, 2006 5:26 PM
To: 'insight-users at itk.org'
Subject: I need to customize itkDiscreteGaussianImageFilter.txx to smooth an image with holes in it


 
Hi,
 
I'm trying to customize itkDiscreteGaussianImageFilter.txx to smooth an image with holes in it.
 
With the current implementation every pixel in the input image must have a valid value in it and all the pixels are pipelined into the Gaussian filter.
In my case the input image has invalid values in it which are signed with a predefined value.
I am applying the smartInnerProduct only to valid pixels. The weight of the kernel is accumulated (will be less than 1 in case of holes). Then the pixel value is divided by the accumulated weight to get the smoothed value.
 
Since the Gaussian filter is applied twice (separable kernel) in each dimension, I need to maintain the weights in a separate image, keep updating them during the runs. After final output image should be divided by the accumulated weight image.
 
In my case the filter should have 2 inputs (an input image and an input weight image) and 2 outputs (an output image and an output weight image).
If I change the structure of NeighborhoodOperatorImageFilter.txx to have the weight images, I should then change ImageToImageFilter class and then Image source class and so on.

My question is: how do I make the changes into ITK to incorporate an input and output weight images?
 
 

Thanks, 
Avner 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060712/db9043d7/attachment.htm


More information about the Insight-users mailing list