[Insight-users] Filter re-use problems

Karthik Krishnan Karthik.Krishnan at kitware.com
Mon Feb 7 15:45:36 EST 2005


Hi Zach,

Sorry about the confusion. After some "lessons" from Master Luis, here 
is what is happening,

You cannot connect the output of a filter to the filter's input and use 
it iteratively without disconnecting the pipeline. So after the first 
iteration, use
mask->DisconnectPipeline();
as in
Loop()
{
   filter->SetInput( input );
   filter->Update();
   output = filter->GetOutput();
   output->DisconnectPipeline();
   input = output;
}

See any one of the iterative filters, for example 
Code/BasicFilters/itkVotingBinaryIterativeHoleFillingImageFilter.txx

Does this help ?

Pipelines in ITK:
See 
http://public.kitware.com/pipermail/insight-users/2004-January/006293.html
or chapter 13 of the Guide.

Thanks
kk


Zachary Pincus wrote:

> Karthik,
>
> Thanks for your email. Unfortunately, calling 
> mask->UpdateLargestPossibleRegion(); gives a compile-time error: mask 
> is an Image::Pointer, and there doesn't seem to be such a method for 
> Images.
>
> If I instead call m_Resampler->UpdateLargestPossibleRegion(); before 
> or after calling m_Resampler->SetInput(mask);, still nothing happens.
>
> You are, however, correct in your guess that the size of the input 
> changes: there is no resolution change, but the input image is 
> rotated, changing the size. However, between the iterations (e.g. 
> calling function 1 and 2 on image A, and then on image B, the size of 
> the input image also changes... but that works fine.) I guess that I 
> basically still don't understand the pipeline mechanism and how it 
> caches the region information -- I figured that when a new input was 
> set, everything should be recomputed -- right?
>
> Thanks for all your time on this,
>
> Zach Pincus
>
>
> On Feb 6, 2005, at 12:04 AM, Karthik Krishnan wrote:
>
>> Hi Zach,
>>
>> Sorry about the earlier mail.
>>
>> Please use
>> mask->UpdateLargestPossibleRegion() instead of Update();
>>
>> I am guessing that the size of the input to the resampler in the 
>> second function changes because the resampler in the first function 
>> is changing the resolution.
>>
>> Does this help ?
>>
>> Thanks
>> kk
>
>
>
>




More information about the Insight-users mailing list