[Insight-users] Repeat use of filter

Jesse Ross-Jones jesse.rj at gmail.com
Mon Jul 22 03:41:32 EDT 2013


Hi Saurabh,
Thanks very much, using UpdateLargestPossibleRegion() instead of Update()
is what is required to be able to reuse filters in a loop.

Much appreciated!
Jesse


On Fri, Jul 19, 2013 at 6:31 PM, <srbh.garg at gmail.com> wrote:

>  Hello Jesse,
>
> If you want to reuse a filter use UpdateLargestPossibleRegion() instead of
> Update() and make sure you do it for all filters before
> calling GetOutput().
>
> HTH,
> Saurabh
>
>
> *From:* Jesse Ross-Jones
> *Sent:* Friday, July 19, 2013 1:37 AM
> *To:* insight-users at itk.org
>
> Hello,
>
> I am using ITK to write a method which requires the repeated use of a
> couple filters. Instead of having to repeat code, is it possible for the
> filters to work within a loop instead?
>
> *A simplified example of the working code is here:*
>
>   dilateFilter->SetInput(this->GetInput());
>   dilateFilter->SetKernel(structuringElement);
>
>   meanFilter->SetRadius(2);
>   meanFilter->SetInput(dilateFilter->GetOutput());
>
>   dilateFilter2->SetInput(meanFilter->GetOutput());
>   dilateFilter2->SetKernel(structuringElement);
>
>   meanFilter2->SetRadius(2);
>   meanFilter2->SetInput(dilateFilter->GetOutput());
>
>   dilateFilter3->SetInput(meanFilter2->GetOutput());
>   dilateFilter3->SetKernel(structuringElement);
>
>   meanFilter3->SetRadius(2);
>   meanFilter3->SetInput(dilateFilter3->GetOutput());
>
>
> *I tried to replace the previous code with something the following, but
> the result produced only a black image.
>
> *
>   dilateFilter->SetInput(this->GetInput());
>   dilateFilter->SetKernel(structuringElement);
>
>   meanFilter->SetRadius(2);
>   meanFilter->SetInput(dilateFilter->GetOutput());
>
>   for ( int j = 0 ; j < 3 ; j = j + 1 ){
>      dilateFilter->SetInput(meanFilter->GetOutput());
>      meanFilter->SetInput(dilateFilter->GetOutput());
>      meanFilter->Update();
>   }
>
>
> Best Regards,
> Jesse
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130722/7859b7a6/attachment.htm>


More information about the Insight-users mailing list