<div dir="ltr"><div><div><div>Hello,<br><br></div>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? <br>
<br></div><b>A simplified example of the working code is here:</b><br><br> dilateFilter->SetInput(this->GetInput());<br> dilateFilter->SetKernel(structuringElement);<br><br> meanFilter->SetRadius(2);<br> meanFilter->SetInput(dilateFilter->GetOutput());<br>
<br> dilateFilter2->SetInput(meanFilter->GetOutput());<br> dilateFilter2->SetKernel(structuringElement);<br><br> meanFilter2->SetRadius(2);<br> meanFilter2->SetInput(dilateFilter->GetOutput());<br><br>
dilateFilter3->SetInput(meanFilter2->GetOutput());<br> dilateFilter3->SetKernel(structuringElement);<br><br> meanFilter3->SetRadius(2);<br> meanFilter3->SetInput(dilateFilter3->GetOutput());<br><br>
<br></div><b>I tried to replace the previous code with something the following, but the result produced only a black image. <br><br></b><br> dilateFilter->SetInput(this->GetInput());<br> dilateFilter->SetKernel(structuringElement);<br>
<br> meanFilter->SetRadius(2);<br> meanFilter->SetInput(dilateFilter->GetOutput());<div><br> for ( int j = 0 ; j < 3 ; j = j + 1 ){<br> dilateFilter->SetInput(meanFilter->GetOutput());<br> meanFilter->SetInput(dilateFilter->GetOutput());<br>
meanFilter->Update();<br> }<br><br><br></div><div>Best Regards,<br></div><div>Jesse<br></div><div><br><br></div></div>