<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">try using binary opening/<a href="https://itk.org/Doxygen/html/classitk_1_1BinaryMorphologicalClosingImageFilter.html">closing</a>, which are implemented as binary dilation and erosion.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><font face="verdana, sans-serif"><a href="https://itk.org/Doxygen/html/group__MathematicalMorphologyImageFilters.html">https://itk.org/Doxygen/html/group__MathematicalMorphologyImageFilters.html</a></font></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 2:43 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 dir="ltr">
<div id="m_3113478342312678994divtagdefaultwrapper" 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="m_3113478342312678994Signature">
<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 style="display:inline-block;width:98%">
<div id="m_3113478342312678994divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dženan Zukić <<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>><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 class="h5">
<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.<wbr>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="m_3113478342312678994HOEnZb">
<div class="m_3113478342312678994h5">
<div dir="ltr">
<div id="m_3113478342312678994m_-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_3113478342312678994m_-4268808616817952521divRplyFwdMsg" dir="ltr"><br>
</div>
<div>
<div id="m_3113478342312678994m_-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_3113478342312678994m_-4268808616817952521divRplyFwdMsg" dir="ltr">
<div> </div>
</div>
<div>
<div id="m_3113478342312678994m_-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_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>                                       ImageReaderType::Pointer reader = ImageReaderType::New();</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>                                        reader->SetFileName("contour.m<wbr>ha"); </div>
<div><span class="m_3113478342312678994m_-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::BinaryFillholeImageFilter<wbr>< UCharImageType > FilterType;</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>FilterType::Pointer filter = FilterType::New();</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->SetInput( reader->GetOutput() );</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->SetForegroundValue( itk::NumericTraits< unsigned char >::min() );</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span></div>
<div></div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>filter->Update();</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span></div>
<div>                                                // Save the BinaryFillHoleImage</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>{</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>typedef itk::ImageFileWriter<UCharImag<wbr>eType> ImageWriterType;</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>ImageWriterType::Pointer writer = ImageWriterType::New();</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetFileName("BinaryFil<wbr>lHoleImage.mha");</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->SetInput(filter->GetOu<wbr>tput());</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>try{</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>writer->Update();</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>}catch(itk::ExceptionObject &e){</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>std::cerr << e << std::endl;</div>
<div><span class="m_3113478342312678994m_-4268808616817952521Apple-tab-span" style="white-space:pre-wrap"></span>}</div>
<div><span class="m_3113478342312678994m_-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_3113478342312678994m_-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></div>
</div>
</div>

</blockquote></div><br></div>