<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:'Times New Roman', Times, serif;" dir="ltr">
<p>Hi Dzenan,</p>
<p><br>
</p>
<p>My goal is to obtain the big contour of the 3D image. For this reason, I tried to use
<span style="font-family: Calibri, sans-serif; font-size: 14.6667px;">Binary Fill hole Image Filter  and after the <span>BinaryContourImageFilter.</span></span></p>
<p><span style="font-family: Calibri, sans-serif; font-size: 14.6667px;"><span>Could you provide me another way using ITK, please?</span></span></p>
<p><span style="font-family: Calibri, sans-serif; font-size: 14.6667px;"><span><br>
</span></span></p>
<p><span style="font-family: Calibri, sans-serif; font-size: 14.6667px;"><span>Best regards,</span></span></p>
<div id="Signature">
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"></font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"><br>
</font></span></div>
<div><br>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dženan Zukić <dzenanz@gmail.com><br>
<b>Sent:</b> 04 February 2017 20:03<br>
<b>To:</b> Abdelkhalek Bakkari<br>
<b>Cc:</b> insight-users<br>
<b>Subject:</b> Re: Binary Fill hole Image Filter for 3D Image</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
Hi Abdelkhalek,</div>
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
<br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
your image does not have any holes! The input and output images are binary identical (examined using file compare tool). If I modify your input image to also contain a real hole (not connected to image edge or the background), it gets filled properly. See attached.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
<br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
Regards,</div>
<div class="gmail_default" style="font-family:verdana,sans-serif; font-size:small">
Dženan</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Feb 4, 2017 at 1:28 PM, Abdelkhalek Bakkari <span dir="ltr">
<<a href="mailto:bakkari.abdelkhalek@hotmail.fr" target="_blank">bakkari.abdelkhalek@hotmail.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div class="HOEnZb">
<div class="h5">
<div dir="ltr">
<div id="m_-4268808616817952521divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:'Times New Roman',Times,serif">
<p><br>
</p>
<div style="color:rgb(0,0,0)">
<div id="m_-4268808616817952521divRplyFwdMsg" dir="ltr"><br>
</div>
<div>
<div id="m_-4268808616817952521divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:'Times New Roman',Times,serif">
<div style="color:rgb(0,0,0)">
<div id="m_-4268808616817952521divRplyFwdMsg" dir="ltr">
<div> </div>
</div>
<div>
<div id="m_-4268808616817952521divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:'Times New Roman',Times,serif">
<p><font face="Times New Roman, sans-serif" style="color:rgb(33,33,33); font-size:15px">Dear ITK-users,</font><span style="color:rgb(33,33,33); font-size:15px"></span></p>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif"><br>
</font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">I tried to adopt the BinaryFillholeImageFilter for 3D image </span></font><font color="#212121"><span style="font-size:15px">(contour.mha). Unfortunately,  the
 result which I obtained is not what I expect.</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px"><br>
</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">The fragment of  code which I used is :</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px"><br>
</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">                                                // Lecture of the contour.mha</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">                                               <span style="color:rgb(33,33,33); font-family:"Times New Roman",sans-serif; font-size:15px"> </span><span style="color:rgb(33,33,33); font-family:"Times New Roman",sans-serif; font-size:15px">typedef
 itk::Image< unsigned char, 3 > UCharImageType;</span>
<div>                                               typedef itk::ImageFileReader<<span style="color:rgb(33,33,33); font-family:"Times New Roman",sans-serif; font-size:15px">UCharImag<wbr>eType</span>> ImageReaderType;</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>                                       ImageReaderType::Pointer reader = ImageReaderType::New();</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>                                        reader->SetFileName("contour.<wbr>mha"); </div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>                                        reader->Update();</div>
</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px"><br>
</span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">                                               // Binary Fill Hole Image Filter<span></span></span></font></font></div>
<div><font face="Times New Roman, sans-serif"><font color="#212121"><span style="font-size:15px">
<div>                                                typedef itk::<wbr>BinaryFillholeImageFilter< UCharImageType > FilterType;</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>FilterType::Pointer filter = FilterType::New();</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->SetInput( reader->GetOutput() );</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->SetForegroundValue( itk::NumericTraits< unsigned char >::min() );</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span></div>
<div></div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->Update();</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span></div>
<div>                                                // Save the BinaryFillHoleImage</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>{</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::ImageFileWriter<<wbr>UCharImageType> ImageWriterType;</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>ImageWriterType::Pointer writer = ImageWriterType::New();</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetFileName("<wbr>BinaryFillHoleImage.mha");</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetInput(filter-><wbr>GetOutput());</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>try{</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->Update();</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>}catch(itk::ExceptionObject &e){</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>std::cerr << e << std::endl;</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<div><span class="m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<br>
</span></font></font></div>
<div style="color:rgb(33,33,33); font-size:15px"><br>
</div>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif"></font></div>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif"><br>
</font></div>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif">Thank you in advance.</font></div>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif"><br>
</font></div>
<div style="color:rgb(33,33,33); font-size:15px"><font face="Times New Roman, sans-serif">Kind regards,</font></div>
<br>
<p></p>
<p><br>
</p>
<div id="m_-4268808616817952521Signature"><font size="3" face="Garamond">Abdelkhalek Bakkari</font>
<div><span style="line-height:14px"><font size="3" face="Garamond">Ph.D candidate in Computer Science</font></span></div>
<div><span style="line-height:20.82666778564453px; background-color:rgb(255,255,255)"><font face="Garamond" size="3">Institute of Applied Computer Science</font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3">Lodz University of Technology, Poland</font></span></div>
<div><span style="line-height:18.399999618530273px"><font face="Garamond" size="3"><br>
</font></span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>