[ITK] [ITK-users] Binary Fill hole Image Filter for 3D Image

Dženan Zukić dzenanz at gmail.com
Sat Feb 4 14:03:09 EST 2017


Hi Abdelkhalek,

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.

Regards,
Dženan

On Sat, Feb 4, 2017 at 1:28 PM, Abdelkhalek Bakkari <
bakkari.abdelkhalek at hotmail.fr> wrote:

>
>
>
>
> Dear ITK-users,
>
> I tried to adopt the BinaryFillholeImageFilter for 3D image (contour.mha).
> Unfortunately,  the result which I obtained is not what I expect.
>
> The fragment of  code which I used is :
>
>                                                 // Lecture of the
> contour.mha
>                                                 typedef itk::Image<
> unsigned char, 3 > UCharImageType;
>                                                typedef
> itk::ImageFileReader<UCharImageType> ImageReaderType;
>                                        ImageReaderType::Pointer reader =
> ImageReaderType::New();
>                                         reader->SetFileName("contour.
> mha");
>                                         reader->Update();
>
>                                                // Binary Fill Hole Image
> Filter
>                                                 typedef itk::BinaryFillholeImageFilter<
> UCharImageType > FilterType;
> FilterType::Pointer filter = FilterType::New();
> filter->SetInput( reader->GetOutput() );
> filter->SetForegroundValue( itk::NumericTraits< unsigned char >::min() );
> filter->Update();
>                                                 // Save the
> BinaryFillHoleImage
> {
> typedef itk::ImageFileWriter<UCharImageType> ImageWriterType;
> ImageWriterType::Pointer writer = ImageWriterType::New();
> writer->SetFileName("BinaryFillHoleImage.mha");
> writer->SetInput(filter->GetOutput());
> try{
> writer->Update();
> }catch(itk::ExceptionObject &e){
> std::cerr << e << std::endl;
> }
> }
>
>
>
> Thank you in advance.
>
> Kind regards,
>
>
> Abdelkhalek Bakkari
> Ph.D candidate in Computer Science
> Institute of Applied Computer Science
> Lodz University of Technology, Poland
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170204/c729545d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2017-02-04 13.57.26.png
Type: image/png
Size: 21085 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20170204/c729545d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Images.7z
Type: application/octet-stream
Size: 64129 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20170204/c729545d/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tester.cpp
Type: text/x-c++src
Size: 1235 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/community/attachments/20170204/c729545d/attachment-0001.cpp>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list