[Insight-users] Repeat use of filter
srbh.garg at gmail.com
srbh.garg at gmail.com
Fri Jul 19 12:31:29 EDT 2013
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/20130719/c93be4f7/attachment.htm>
More information about the Insight-users
mailing list