<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Dear Bradley and Jon,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thank you for your help. I successfully tried both the methods, using BinaryShapeOpeningImageFilter and BinaryImageToLabelMapFilter.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks & Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ruturaj<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Bradley Lowekamp [mailto:blowekamp@mail.nih.gov]
<br>
<b>Sent:</b> Tuesday, May 20, 2014 4:58 PM<br>
<b>To:</b> Jon Haitz Legarreta<br>
<b>Cc:</b> Girish, Gavaskar Ruturaj; community@itk.org<br>
<b>Subject:</b> Re: [ITK] MATLAB bwareaopen() equivalent in ITK<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You should look into the LabelMap Module and framework[1]. The ITK LabelMap class hold a Run Length Encoded (RLE) labeled image, which can be converted from a binary[2], or label image[3]. Additionally, there can be statistics associated
 with each of these label objects.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">More specifically the BinaryShapeOpeningImageFilter[4] will do exactly what you need if you set the attribute to NUMBER_OF_PIXELS and the Lambda to the threshold value. This filter will convert you binary image to an ITK label map, compute
 the required statistics, remove the label objects below the threshold and then create the binary image. It should do the same that as bwareaopening. The LabelMap module has a lot of very useful and specific filters for manipulating objects based of shape and
 attributes.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The LabelMap module was contributed through the Insight Journal by Gaetan Lehman[6].<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hope that helps,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Brad<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">[1] <a href="http://www.itk.org/Doxygen/html/group__ITKLabelMap.html">http://www.itk.org/Doxygen/html/group__ITKLabelMap.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToLabelMapFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1BinaryImageToLabelMapFilter.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[3] <a href="http://www.itk.org/Doxygen/html/classitk_1_1LabelImageToLabelMapFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1LabelImageToLabelMapFilter.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[4] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryShapeOpeningImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1BinaryShapeOpeningImageFilter.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[5] <a href="http://www.itk.org/Doxygen/html/classitk_1_1ShapeLabelObject.html#ae0f49d30bbbe68d6d56d5192d7ace314">http://www.itk.org/Doxygen/html/classitk_1_1ShapeLabelObject.html#ae0f49d30bbbe68d6d56d5192d7ace314</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[6] <span style="font-family:"Verdana","sans-serif";background:white"> </span><a href="http://hdl.handle.net/1926/584"><span style="font-family:"Verdana","sans-serif";color:#4665A2;background:white;text-decoration:none">http://hdl.handle.net/1926/584</span></a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On May 20, 2014, at 4:35 AM, Jon Haitz Legarreta <<a href="mailto:jhlegarreta@vicomtech.org">jhlegarreta@vicomtech.org</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Dear Ruturaj,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">binary math morphology filters [1] will be of help for this task. The itk::BinaryOpeningByReconstructionImageFilter [2] is probably the filter you are looking for.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">HTH,<br>
JON HAITZ<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><br>
[1] <a href="http://www.itk.org/Doxygen/html/group__ITKBinaryMathematicalMorphology.html">
http://www.itk.org/Doxygen/html/group__ITKBinaryMathematicalMorphology.html</a><br>
[2] <a href="http://www.itk.org/Doxygen/html/classitk_1_1BinaryOpeningByReconstructionImageFilter.html">
http://www.itk.org/Doxygen/html/classitk_1_1BinaryOpeningByReconstructionImageFilter.html</a><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></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:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Dear all,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">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?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks & Regards,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Ruturaj<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</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><o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<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">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>