<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Re: [Insight-users] erosion performance for binary images</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>Hi Dan and Gaetan,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>First of all: thanks for your feedback.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>I forgot about the importance of the specific choice
of the kernel. That makes sense of course. In my test code I used the
line</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial> erosionFilter->SetRadius( radii[ i ]
);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>and assumed it would be give a ball. Now I
use:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial> erosionFilter->SetKernel(
itk::FlatStructuringElement<Dimension>::Box( radius )
);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>or</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial> erosionFilter->SetKernel(
itk::FlatStructuringElement<Dimension>::Ball( radius )
);</FONT></DIV></SPAN><SPAN class=031202716-05062009></SPAN>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>Then the VHGW filter indeed did not run for the
Ball, because it is not decomposable.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>The new performance results for ball and box are in the
attachments. For the box the binary erode still seems to be faster up till a
radius of 8, after which the VHGW takes over. The latter is not constant for
increasing radius though.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=031202716-05062009><FONT color=#0000ff
size=2 face=Arial>I added the source code in the zip, so you can reproduce the
results. You can also find the binary image on which I did the test in the
zip.</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Gaëtan Lehmann
[mailto:gaetan.lehmann@jouy.inra.fr] <BR></FONT></DIV>
<P><FONT size=2><BR>The algorithm used in BinaryErodeImageFilter can't be
easily <BR>constrained to a zone, and so it is difficult to multithread
it.<BR>If you want to perform an erosion with a radius of 1 (on all
the <BR>dimension), BinaryContourImageFilter followed by a
SubtractImageFilter <BR>would be a lot faster (really) especially on a
multicore system, as <BR>they are both multithreaded. Some timings are
available in section 3 <BR>of <A
href="http://insight-journal.com/download/viewpdf/217/2">http://insight-journal.com/download/viewpdf/217/2</A><BR></FONT></P></BLOCKQUOTE></BODY></HTML>