[Insight-developers] RequestedRegion are modified when callingitk filters (2)

Miller, James V (GE, Research) millerjv at crd.ge.com
Wed Mar 15 09:00:47 EST 2006


As a user of a pipeline, you should never modify the LargestPossibleRegion
for a data object in the middle of the pipeline.  You can modify the RequestedRegion.

(Back to the original question....)

Typically one may set the RequestedRegion on the output of the last filter
in the pipeline.  This will be propagated back up the pipeline with each 
filter determining how much input it would need to generate the output 
requested region.

Many algorithms cannot know a priori how much input they would need to
produce an output.  A classic example is a region growing algorithm.  For a 
given seed point, the algorithm simply cannot know where the algorithm is
going to take it across the input.  If it did know this a priori, the 
region growing algorithm would hardly be necessary.  The result is that
such filters automatically set the input requested region to the all 
of the input (the LargestPossibleRegion). Another example is something
like StatisticsImageFilter.  This filter needs the entire input to 
properly calculate the image statistics.  To get the statistics for 
a smaller region, one will have to jump through extra hoops (using ExtractImageFilter)
to force the filter to just calculate over a region.

Such filters have to make another choice in their implementation. Since they
requested the entire input, do they produce "just" the output region requested
or do they produce the "entire" output.  The decision here is largely based
on the algorithm.  While some algorithms may not know how much input
they need, they can still produce just a piece of the output.  Others
will default to producing the entire output.


-----Original Message-----
From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
Of Karthik Krishnan
Sent: Tuesday, March 14, 2006 5:08 PM
To: Karthik Krishnan
Cc: Luis Ibanez; insight-developers at public.kitware.com
Subject: Re: [Insight-developers] RequestedRegion are modified when
callingitk filters (2)




Karthik Krishnan wrote:

> What I meant was: what if I want to put the filter in a pipeline and 
> just have my application run on an interactive user chosen VOI. I 
> would need to use crop filters etc ?
> It could run the separable gaussian filters on the requested region 
> instead of the whole region.
>
> If I did want it to run on the whole image, I could always say: 
> UpdateLargestPossibleRegion().  But there is no way I can have it 
> update on just a defined image region.
>
Correcting myself:
I guess I could say :

filter->GetInput()->SetLargestPossibleRegion()->( voiRegion );
filter->Update();

and have it work.

sorry for the noise
-karthik

> -karthik
>
> Luis Ibanez wrote:
>
>>
>> Hi Arnaud,
>>
>> The Recursive Gaussian image filter needs the entire image as
>> input because it is implemented using IIR separable filters.
>>
>> IIR filters have infinite support and therefore cannot be
>> computed using pieces of the image.  A better understanding
>> of this implementation can be gained by looking at how it
>> is expressed in the Z transform space.
>>
>>
>> You may want to read the report by Rachid Deriche:
>>
>> "Recursively Implementing The Gaussian and Its Derivatives",
>> INRIA, 1993,
>> ftp://ftp.inria.fr/INRIA/tech-reports/RR/RR-1893.ps.gz
>>
>>
>> Where these filters were originally proposed.
>>
>>
>>
>>
>>    Regards,
>>
>>
>>
>>        Luis
>>
>>
>> ------------------------
>> Karthik Krishnan wrote:
>>
>>>
>>>
>>> Arnaud Garcia wrote:
>>>
>>>> Hi itk developers,
>>>>
>>>> It seems that most itk filters change the RequestedRegion when 
>>>> calling them ...
>>>> Some filters overide  the GenerateInputRequestedRegion with  
>>>> something like:
>>>>
>>>> SetRequestedRegion( input->GetLargestPossibleRegion() );
>>>>
>>>>
>>>>
>>>> => So if you set your requested region and call such filters you 
>>>> have to set it again after calling theses filters ...
>>>>
>>>> is it right ?
>>>>
>>> Yes. This is the expected behaviour since if you use such a filter 
>>> in a pipeline and the filter needs the whole input to process, it 
>>> must make such a request to those filters on its upstream. That 
>>> said, such a request will not be propagated downstream. For instance 
>>> if you use
>>>
>>> A --> B --> C
>>> and B needs the whole input to process.
>>>
>>> C->SetRequestedRegion( ... )
>>> C->Update();
>>>
>>> This should set the requested regions of A's input and B's input to 
>>> the whole image, but C's input's requested region should stay 
>>> unchanged.
>>>
>>> That said, there are a good number of filters that require the whole 
>>> input to process, either because they do, or in some cases the 
>>> filter is not well written to handle them.
>>>
>>> For instance RecursiveSeparableGaussianFilter: I am not sure why the 
>>> filter must make an assumption that it requires the entire input. It 
>>> doesn't sound reasonable. Maybe the others have something to say 
>>> about it.
>>>
>>> -karthik
>>>
>>>> thanks for answer,
>>>>
>>>> Arnaud
>>>>
>>>> _______________________________________________
>>>> Insight-developers mailing list
>>>> Insight-developers at itk.org
>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>>
>>> _______________________________________________
>>> Insight-developers mailing list
>>> Insight-developers at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>>
>>
>>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list