<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1439510019394_2981">Hi,</div><div><br></div><div> I am attempting a simple erosion on a binary input image which is pretty much a white box on a black background.</div><div><br></div><div id="yui_3_16_0_1_1439510019394_3178"> The following is my code snippet. Not sure why it fails to erode the image. Am I missing something ? <br></div><div id="yui_3_16_0_1_1439510019394_3037"><br></div><div dir="ltr" id="yui_3_16_0_1_1439510019394_2982">typedef itk::FlatStructuringElement<2 > StructuralElementType;<br class="" id="yui_3_16_0_1_1439510019394_2999">StructuralElementType::RadiusType radius;<br class="" id="yui_3_16_0_1_1439510019394_3001">radius.Fill(7 );<br class="" id="yui_3_16_0_1_1439510019394_3003">StructuralElementType structural_element = StructuralElementType::Box( radius );<br class="" id="yui_3_16_0_1_1439510019394_3005"> <br class="" id="yui_3_16_0_1_1439510019394_3007"><br class="" id="yui_3_16_0_1_1439510019394_3009"> typedef itk::BinaryErodeImageFilter <UCharImageType, UCharImageType, StrelType> BinaryErodeImageFilterType;<br class="" id="yui_3_16_0_1_1439510019394_3011"> BinaryErodeImageFilterType::Pointer erodeFilter = BinaryErodeImageFilterType::New();<br class="" id="yui_3_16_0_1_1439510019394_3013"> erodeFilter->SetInput(my_binary_image);<br class="" id="yui_3_16_0_1_1439510019394_3015"> erodeFilter->SetKernel(structural_element);<br class="" id="yui_3_16_0_1_1439510019394_3017"> try<br class="" id="yui_3_16_0_1_1439510019394_3019"> {<br class="" id="yui_3_16_0_1_1439510019394_3021"> erodeFilter->Update();<br class="" id="yui_3_16_0_1_1439510019394_3023"> }<br></div><div dir="ltr" id="yui_3_16_0_1_1439510019394_2997">catch(...)</div><div id="yui_3_16_0_1_1439510019394_3117" dir="ltr">{</div><div id="yui_3_16_0_1_1439510019394_3118" dir="ltr"> cout<<"Failure";<br></div><div id="yui_3_16_0_1_1439510019394_3119" dir="ltr">}</div><div id="yui_3_16_0_1_1439510019394_3121" dir="ltr"><br></div><div id="yui_3_16_0_1_1439510019394_3123" dir="ltr">UCharImageType::Pointer new_image = erodeFilter->GetOutput();<br></div><div id="yui_3_16_0_1_1439510019394_3152" dir="ltr"><br></div><div id="yui_3_16_0_1_1439510019394_2996">thanks,</div><div id="yui_3_16_0_1_1439510019394_3153">Emma<br></div><div id="yui_3_16_0_1_1439510019394_3181"><br></div><div id="yui_3_16_0_1_1439510019394_2983"><br></div><div id="yui_3_16_0_1_1439510019394_3182"><br></div></div></body></html>