<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>You have created a loop in the ITK pipeline as you are reusing the output of the mean as the input of the dilate filter. It's likely easiest to just do the following for each filter:</div><div><br></div><div>img = prevfilter->GetOutput();</div><div>img->DisconnectPipeline()</div><div>filter->SetInput(img)</div><div>filter->Update()</div><div><br></div><div>The above approach will allow you to execute each filter in isolation, however I am not sure what your goals of your pipeline are. If you need to stream, then you need to create a separate filter of each execution as you initially did. If you are trying to minimize memory, then you will need to look into grafting images, and which filter can run in-place.</div><div><br></div><div>Brad</div><div><br><div><div>On Jul 19, 2013, at 4:37 AM, Jesse Ross-Jones <<a href="mailto:jesse.rj@gmail.com">jesse.rj@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><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>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>