[Insight-users] nested filters behaving like nested Image
functions
Miller, James V (Research)
millerjv at crd.ge.com
Tue Nov 1 09:53:25 EST 2005
Jerome,
With respect to C): Why is B not an image function? Is it only because the function you want does not exist and it exists as a filter? One option is to create an image function that does what you want.
To use a filter like this, you will need:
1) Make sure the outer filter's GenerateInputRequestedRegion() takes into account any padding needed by the inner filter.
2) Depending on the filter you are calling internally you may need to be a careful with managing the pipeline. At the 10,000 foot
level, you should be able to specify a requested region on the output of the inner filter and call Update(). The output of the inner
filter should not need to reallocate. The memory management within the pipeline will try to reuse a buffer if it is the same size or
smaller than the current buffer. Calling Update() on the inner filter may affect the RequestedRegion of the outer filter's input.
This may or may not cause a problem with the remainder of your processing. If you try to access the RequestedRegion
of the outer filter's input after you do all the Update()'s on the inner filter, said RequestedRegion may be very small.
A solution to this it to create a shallow copy of the outer filter's input image. Just create a new image of the same type
as the input. Set the regions to match the outer filter's input regions. But instead of calling Allocate() just set the PixelContainer
on the shallow image to be the same PixelContainer as the outer's filter's input. Then use this shallow copy as the input to
your inner filters.
-----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 SCHMID, Jerome
Sent: Tuesday, November 01, 2005 2:44 AM
To: insight-users at itk.org
Subject: [Insight-users] nested filters behaving like nested Image functions
Hi all,
Sorry for a subject title so complicated, I tried to find an "explicit" sentence...
In order to illustrate my questions, let's take a simple example:
filter A will perform this operation in its GenerateData() :
Given a set of pixels within the requested region of an input image I, do
{
// current Pixel in the input is named input_px. The corresponding pixel at the same position in the output is called ouput_px
apply a filter B locally: "output_px = B( input_px)"
}
Some remarks:
a) B should be created _before_ the traversal of the pixels set.
b) B performs a _local_ treatment, that means it just needs a required region on the input (as usually performed in itk with the region enlargement techniques.)
c) B is a filter, _not_ an imageFunction, that means that no current itk class allows to do:
B->SetInputImage(I);
output_px = B->Evaluate( input_px_position );
The questions are then:
1) How to deal with remark c)? Should I:
- create a requested region whose size is (1,1,1) in 3D and whose position is the current input pixel
- set it to filter B
- Update() on B
- Retrieve the value of output_pixel with GetPixel()
2) If my previous solution is correct, how the filter B will behave with successive SetRequestedRegion + Update() calls as we have to traverse a set of different pixels that are not continuous? As the size of the requestedRegion doesn't change, its internal buffered region will remains the same ( i.e requested region + elargement needed for processing)? Or due to call of GetPixel of different regions within the image, some allocation will be done?
I do not need to perform a kind of "GraftOutput() operation" as everytime I can copy the value of the output_pixel in another structure that is much leighter than the whole image as it is not very dense.
I hope I have been enough clear...!
Thank you!
Jerome
-----------------------------------
Jerome SCHMID
Project Manager/ Engineer
Augmented and Virtual Reality
MIS Centre
Prince of Wales Hospital
Chinese University Of Hong-Kong
-----------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051101/7e1a5948/attachment-0001.htm
More information about the Insight-users
mailing list