<div dir="ltr"><div><div>Hi Saurabh,<br></div>Thanks very much, using UpdateLargestPossibleRegion() instead of Update() is what is required to be able to reuse filters in a loop.<br><br></div>Much appreciated!<br>Jesse<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 19, 2013 at 6:31 PM, <span dir="ltr"><<a href="mailto:srbh.garg@gmail.com" target="_blank">srbh.garg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div 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><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 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" face="Calibri, 'Segoe UI', Meiryo, 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'Khmer UI', 'Nirmala UI', Tunga, 'Lao UI', Ebrima, sans-serif"><b>From:</b> Jesse Ross-Jones<br>
<b>Sent:</b> Friday, July 19, 2013 1:37 AM<br><b>To:</b> <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a></font></div></div><div><div class="h5"><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></div></div></div></blockquote></div><br></div>