[ITK-users] Binary Erosion failed

Emma Ryan eryanvtk at yahoo.com
Thu Aug 13 20:00:05 EDT 2015


Hi,
 I am attempting a simple erosion on a binary input image which is pretty much a white box on a black background.
 The following is my code snippet. Not sure why it fails to erode the image. Am I missing something ? 

typedef itk::FlatStructuringElement<2 >    StructuralElementType;
StructuralElementType::RadiusType radius;
radius.Fill(7 );
StructuralElementType structural_element =   StructuralElementType::Box( radius );
    

    typedef itk::BinaryErodeImageFilter <UCharImageType, UCharImageType, StrelType>    BinaryErodeImageFilterType;
    BinaryErodeImageFilterType::Pointer erodeFilter    = BinaryErodeImageFilterType::New();
    erodeFilter->SetInput(my_binary_image);
    erodeFilter->SetKernel(structural_element);
    try
    {
        erodeFilter->Update();
    }
catch(...){    cout<<"Failure";
}
UCharImageType::Pointer new_image = erodeFilter->GetOutput();

thanks,Emma



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150814/66b87d98/attachment.html>


More information about the Insight-users mailing list