<div dir="ltr"><div><div><div><div>Dear Ruturaj,<br></div>did you try the filter?<br><br></div>The filter removes objects smaller than a structuring element in the image, which as far as I understand, is your goal.<br><br>
</div>In principle, math morphology filters do not impose any a priori on your object's shape.<br><br></div><div>Otherwise, you can use a filter to label the connected components [1] of your binary image, then count the number of pixels corresponding to a label, and delete some labels/connected components [2] according to a threshold set on the number of pixels. <br>
<br></div><div>HTH,<br></div>JON HAITZ<br><br>[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToLabelMapFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToLabelMapFilter.html</a><br>
[2] <a href="http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ManuallyRemovingLabels">http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ManuallyRemovingLabels</a><br><div><div><br><br><div><div><div><div><div><div>
<div><div class="gmail_extra"><br><div class="gmail_quote">On 20 May 2014 10:48, Girish, Gavaskar Ruturaj <span dir="ltr"><<a href="mailto:gavaskar.ruturaj.girish@philips.com" target="_blank">gavaskar.ruturaj.girish@philips.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Dear Jon,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Thanks for your reply. I am looking for a filter which will remove all white objects containing less than a specified number of pixels, regardless of their
 shape. I am not sure if morphological operations, which the filters you mentioned are using, will be fully successful as the result will also depend on the objects’ shape. Is there a way to ‘threshold’ objects based on their size (no. of pixels), possibly
 even involving multiple filters?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Thanks & Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)">Ruturaj<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10pt;font-family:"Tahoma","sans-serif""> Jon Haitz Legarreta [mailto:<a href="mailto:jhlegarreta@vicomtech.org" target="_blank">jhlegarreta@vicomtech.org</a>]
<br>
<b>Sent:</b> Tuesday, May 20, 2014 2:06 PM<br>
<b>To:</b> Girish, Gavaskar Ruturaj<br>
<b>Cc:</b> <a href="mailto:community@itk.org" target="_blank">community@itk.org</a><br>
<b>Subject:</b> Re: [ITK] MATLAB bwareaopen() equivalent in ITK<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Dear Ruturaj,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt">binary math morphology filters [1] will be of help for this task. The itk::BinaryOpeningByReconstructionImageFilter [2] is probably the filter you are looking for.<u></u><u></u></p>

</div>
<div>
<p class="MsoNormal">HTH,<br>
JON HAITZ<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
[1] <a href="http://www.itk.org/Doxygen/html/group__ITKBinaryMathematicalMorphology.html" target="_blank">
http://www.itk.org/Doxygen/html/group__ITKBinaryMathematicalMorphology.html</a><br>
[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryOpeningByReconstructionImageFilter.html" target="_blank">
http://www.itk.org/Doxygen/html/classitk_1_1BinaryOpeningByReconstructionImageFilter.html</a><u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 20 May 2014 10:09, Girish, Gavaskar Ruturaj <<a href="mailto:gavaskar.ruturaj.girish@philips.com" target="_blank">gavaskar.ruturaj.girish@philips.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Dear all,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Is there a class in ITK which provides functionality to remove small white objects in a binary image, similar to the function
<span style="font-family:"Courier New"">bwareaopen()</span> in MATLAB? If not, how can this be done?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks & Regards,<u></u><u></u></p>
<p class="MsoNormal">Ruturaj<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div class="MsoNormal" style="text-align:center" align="center">
<hr align="center" size="2" width="100%">
</div>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:gray">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If
 you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail
 and destroy all copies of the original message.</span><u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12pt"><br>
_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div></div></div>
</div>

<br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div></div></div></div></div></div></div></div></div></div></div>