[ITK] [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/community/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/community/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/community/attachments/20170204/1e264bc4/attachment-0003.obj>
-------------- 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