<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 11 (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]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place" /><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName" /><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]--><style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:monospace;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:1831141782;
        mso-list-type:hybrid;
        mso-list-template-ids:-1262822576 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="blue">
<div class="Section1">
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Sergio, thank you for the response. As you said, it was pretty straightforward.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p>&nbsp;</o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">For the record: I calculated the Euler number like this given a label image:<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p>&nbsp;</o:p></span></font></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoNormal" style="color:navy;mso-list:l0 level1 lfo1"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial">isolate the cluster/component using BinaryThresholdImageFilter<o:p></o:p></span></font>
</li><li class="MsoNormal" style="color:navy;mso-list:l0 level1 lfo1"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial">calculate a version with possible holes filled using BinaryFillHoleImageFilter<o:p></o:p></span></font>
</li><li class="MsoNormal" style="color:navy;mso-list:l0 level1 lfo1"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Use XORImageFilter between the two results in an image with only the holes<o:p></o:p></span></font>
</li><li class="MsoNormal" style="color:navy;mso-list:l0 level1 lfo1"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Use ConnectedComponentImageFilter to count the holes.<o:p></o:p></span></font>
</li></ol>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p>&nbsp;</o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">The resulting Euler Number &nbsp;is 1 - &nbsp;nrHoles.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p>&nbsp;</o:p></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center" tabindex="-1">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;
font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> Sergio Vera [mailto:sergio.vera@alma3d.com]
<br>
<b><span style="font-weight:bold">Sent:</span></b> woensdag 5 oktober 2011 17:01<br>
<b><span style="font-weight:bold">To:</span></b> Buuren, T.P.H. (Thomas) van<br>
<b><span style="font-weight:bold">Cc:</span></b> <st1:PersonName w:st="on">insight-users@itk.org</st1:PersonName><br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [Insight-users] Determine Euler number of binary image in ITK (similar to bweuler in Matlab)</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p>&nbsp;</o:p></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">Hi Thomas<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p>&nbsp;</o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">To my knowledge, a single filter that does that calculation does not exists, but it should be pretty straightforward to do by using the label manipulation filters that
 you may use if you compile ITK with ITK_REVIEW set to true.<o:p></o:p></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p>&nbsp;</o:p></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Regards<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">On Wed, Oct 5, 2011 at 2:46 PM, Buuren, T.P.H. (Thomas) van &lt;<a href="mailto:thomas.vanbuuren@tno.nl">thomas.vanbuuren@tno.nl</a>&gt; wrote:<o:p></o:p></span></font></p>
<div link="blue" vlink="purple">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">&nbsp;</span></font><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Does anyone know if there is a way in ITK to determine the Euler number of a binary image, similar to
 the Matlab&#8217;s&nbsp; bweuler(&#8230;) ?</span></font><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">&nbsp;</span></font><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Thank you,
</span></font><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Kind Regards</span></font><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">Thomas</span></font><o:p></o:p></p>
</div>
<p class="MsoNormal"><font size="3" face="monospace"><span style="font-size:12.0pt;
font-family:monospace">This e-mail and its contents are subject to the DISCLAIMER at
<a href="http://www.tno.nl/emaildisclaimer" target="_blank">http://www.tno.nl/emaildisclaimer</a></span></font><o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><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><o:p></o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><br>
<br clear="all">
<o:p></o:p></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt"><o:p>&nbsp;</o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:
12.0pt">--
<br>
Sergio Vera<br>
<br>
&nbsp;<st1:City w:st="on"><st1:place w:st="on">Alma</st1:place></st1:City> IT Systems<br>
&nbsp;C/ Vilana, 4B, 4º 1ª<br>
&nbsp;08022 <st1:City w:st="on"><st1:place w:st="on">Barcelona</st1:place></st1:City><br>
&nbsp;T. (&#43;34) 932 380 592<br>
&nbsp;<a href="http://www.alma3d.com">www.alma3d.com</a><o:p></o:p></span></font></p>
</div>
</div>
</body>
</html>