[Insight-users] Repeat use of filter
Jesse Ross-Jones
jesse.rj at gmail.com
Fri Jul 19 04:37:59 EDT 2013
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/4a8a7abb/attachment.htm>
More information about the Insight-users
mailing list