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

Abdelkhalek Bakkari bakkari.abdelkhalek at hotmail.fr
Sat Feb 4 14:43:07 EST 2017


Hi Dzenan,


My goal is to obtain the big contour of the 3D image. For this reason, I tried to use Binary Fill hole Image Filter  and after the BinaryContourImageFilter.

Could you provide me another way using ITK, please?


Best regards,




________________________________
From: Dženan Zukić <dzenanz at gmail.com>
Sent: 04 February 2017 20:03
To: Abdelkhalek Bakkari
Cc: insight-users
Subject: Re: Binary Fill hole Image Filter for 3D Image

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<mailto: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/d0421869/attachment-0001.html>
-------------- 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