<html><head><style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head><body><div data-externalstyle="false" dir="ltr" style="font-family:Calibri,'Segoe UI',Meiryo,'Microsoft YaHei UI','Microsoft JhengHei UI','Malgun Gothic','Khmer UI','Nirmala UI',Tunga,'Lao UI',Ebrima,sans-serif;font-size:12pt;"><div>Hello Jesse,</div><div> </div><div>If you want to reuse a filter use UpdateLargestPossibleRegion() instead of Update() and make sure you do it for all filters before calling GetOutput(). </div><div> </div><div>HTH,</div><div>Saurabh</div><div data-signatureblock="true"><div> </div><div> </div></div><div style="padding-top: 5px; border-top-color: rgb(229, 229, 229); border-top-width: 1px; border-top-style: solid;"><div><font face="Calibri, 'Segoe UI', Meiryo, 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'Khmer UI', 'Nirmala UI', Tunga, 'Lao UI', Ebrima, sans-serif" style='line-height: 15pt; letter-spacing: 0.02em; font-family: Calibri, "Segoe UI", Meiryo, "Microsoft YaHei UI", "Microsoft JhengHei UI", "Malgun Gothic", "Khmer UI", "Nirmala UI", Tunga, "Lao UI", Ebrima, sans-serif; font-size: 11pt;'><b>From:</b> Jesse Ross-Jones<br><b>Sent:</b> Friday, July 19, 2013 1:37 AM<br><b>To:</b> insight-users@itk.org</font></div></div><div> </div><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>
</div></body></html>