I&#39;m not too familiar with this filter, but a quick scan of the source leads me to believe that it expects a binary image containing zeroes and ones (see below). <div><br></div><div>Genus is of type PixelType. If it is unsigned char and foreground pixels are 255, the result will be overflow errors during the genus calculation never satisfying the pruning condition.<div>
<br></div><div>Perhaps there should be a set foreground value function then genus can be of type int and the pruning condition can be changed to if(genus/m_ForegroundValue &lt; 2).</div><div><br></div><div><div><div>      if (ot.GetCenterPixel())</div>
<div>       {</div><div>         PixelType genus; </div><div>         genus  = ot.GetPixel(offset1) + ot.GetPixel(offset2);</div><div>         genus += ot.GetPixel(offset3) + ot.GetPixel(offset4);</div><div>         genus += ot.GetPixel(offset5) + ot.GetPixel(offset6);</div>
<div>         genus += ot.GetPixel(offset7) + ot.GetPixel(offset8);</div><div>         if (genus &lt; 2)</div><div>           {</div><div>             genus = 0;</div><div>             ot.SetCenterPixel( genus );</div><div>
           }</div><br><div class="gmail_quote">2011/6/7 di xiao <span dir="ltr">&lt;<a href="mailto:xiaodi68@hotmail.com">xiaodi68@hotmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">




<div>
Dear all:<br><br>Anyone successfully used the itkBinaryPruningImageFilter? I searched the Insight-users but no solution about it.<br><br>My codes:<br><br>  //Pruning the thinning image<br>  typedef itk::BinaryPruningImageFilter&lt;ReaderImageType, ReaderImageType&gt; BinaryPruningImageFilterType;<br>
  BinaryPruningImageFilterType::Pointer binaryPruningFilter = BinaryPruningImageFilterType::New();<br>  binaryPruningFilter-&gt;SetInput(binaryThinningFilter-&gt;GetOutput());<br>  binaryPruningFilter-&gt;SetIteration(10);<br>
  binaryPruningFilter-&gt;Update();<br>  binaryPruningFilter-&gt;Print(std::cout, 0);<br><br>imageWriter-&gt;SetInput(binaryPruningFilter-&gt;GetPruning());<br><br>My thinning image is a binary image (background = 0, thinning skeleton = 255).<br>
But I didn&#39;t get any changes after put the thinning image through the pruning filter.<br><br>Did I understand wrongly to using the filter?<br><br>Thanks,<br><font color="#888888"><br>Di<br>                                               
</font></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div></div>