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

Abdelkhalek Bakkari bakkari.abdelkhalek at hotmail.fr
Sat Feb 4 13:28:11 EST 2017





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/insight-users/attachments/20170204/1e264bc4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour.rar
Type: application/octet-stream
Size: 59299 bytes
Desc: contour.rar
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170204/1e264bc4/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BinaryFillHoleImage.rar
Type: application/octet-stream
Size: 59311 bytes
Desc: BinaryFillHoleImage.rar
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170204/1e264bc4/attachment-0003.obj>


More information about the Insight-users mailing list