[Insight-developers] Erosion/Dilation Speed Tests

Miller, James V (Research) millerjv@crd.ge.com
Mon, 12 May 2003 14:29:23 -0400


Thanks Steve :)

The other difference is that the dilation is with a LARGE structuring
element while the erosions are using a small structuring element. 

I am also not sure why the erosions do not produce the same answer (in
this particular case). Why are the radii different in the erosion case?

I think I favor renaming the ObjectMorphology classes to be something like
SimpleBinary[Dilate|Erode]ImageFilter.  But before we do this, I think
we need understand the assumptions made in the ObjectMorphology algorithms
and
the implications of these assumptions on the types of structuring elements
that can be used.

I haven't figured out all the assumptions but I think the ObjectMorphology
classes assume:

1) The center pixel in the structuring element is "on"
2) The structuring element is convex (with no gaps)

I think the ObjectMorphology classes will not produce correct images if
the structuring element were something like

o o x o o 
o o o o o
x o x o x
o o o o o 
o o x o o

or 

o o x o o 
o o x o o 
o o x o o
o o x o o
x x x x x

these are kind of strange structuring elements but it common to use elements
like 

x 0 0 0 x

to try to find lines 4 pixels apart, etc.

It would also be nice if the two object morphology subclasses could be
subclassed from the MorphologyImageFilter.  As it currently stands, we have
to have to override the ThreadedGenerateData method of MorphologyImageFilter
in order to 
make use of the optimizations of the ObjectMorphology class.  We would
probably
also have to make the Evaluate methods perform similar operations (return
values
vs set values in the output directly).



> -----Original Message-----
> From: Stephen R. Aylward [mailto:aylward@unc.edu]
> Sent: Monday, May 12, 2003 1:54 PM
> To: Miller, James V (Research)
> Cc: Insight-Developers (E-mail)
> Subject: Re: [Insight-developers] Erosion/Dilation Speed Tests
> 
> 
> The erosions was run on a different image than the dilations.
> 
> The only valid comparison is between the BinaryErode and the 
> ObjectErode 
> methods and between the BinaryDilate and the BinaryErode methods. 
> Those tests were performed using the same images.
> 
> Stephen
> 
> Miller, James V (Research) wrote:
> > This is not what I would have expected.  
> > 
> > Digging through Quantify results previously, the BinaryDilate 
> > was about twice the speed of the BinaryErode.
> > 
> > I'll run the itkObjectMorphologyImageFilterTest through Quantify
> > to see the respective bottlenecks.
> > 
> > Jim
> > 
> > 
> >>-----Original Message-----
> >>From: Stephen R. Aylward [mailto:aylward@unc.edu]
> >>Sent: Sunday, May 11, 2003 2:01 PM
> >>To: Insight-Developers (E-mail)
> >>Subject: [Insight-developers] Erosion/Dilation Speed Tests
> >>
> >>
> >>Hi,
> >>
> >>I ran some speed tests to compare
> >>	itkObject[Erode|Dilate]MophologyImageFilter
> >>with
> >>	itkBinary[Erode|Dilate]ImageFilter
> >>
> >>These tests are contained in 
> >>Insight/Testing/Code/BasicFilters/itkObjectMophologyImageFilterTest
> >>
> >>Data: 50x50x50, unsigned short image
> >>
> >>Windows 2000 - compiled in MSVC++6 with RelWithDebInfo mode.
> >>
> >>		Pentium 4		Dual Pentium Xeon
> >>		Avg Time (sec)		Avg Time (sec)
> >>ObjectDilate	0.425			0.14
> >>BinaryDilate	12.37			4.10
> >>
> >>ObjectErode	0.035			0.015
> >>BinaryErode	0.130			0.047
> >>
> >>So, for Dilation the speedup is ~30x and for erosion the 
> >>speedup is ~4x. 
> >>   This puts ITK as
> >>
> >>Note that ObjectErode is not a 100% compatible implementation of 
> >>erosion.   You actually need to use (radius-1) for the 
> ObjectErosion 
> >>filter to get the same result as with BinaryErosion - I did 
> >>not do that 
> >>in the above tests - so ObjectErode is actually faster than 
> reported.
> >>
> >>What about swapping the names of these two filters?   The 
> >>ObjectDilate/Erode filters assumes there are fixed (user specified) 
> >>foreground and background values.   The BinaryDilate/Erode filters 
> >>perform tests on adjacent pixels to determine what value with 
> >>which to 
> >>fill a dilation/erosion.
> >>
> >>Stephen
> >>
> >>-- 
> >>===============================================
> >>Dr. Stephen R. Aylward
> >>Assistant Professor of Radiology
> >>Adjunct Assistant Professor of Computer Science
> >>http://caddlab.rad.unc.edu
> >>aylward@unc.edu
> >>(919) 966-9695
> >>
> >>_______________________________________________
> >>Insight-developers mailing list
> >>Insight-developers@public.kitware.com
> >>http://public.kitware.com/mailman/listinfo/insight-developers
> >>
> > 
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
> 
> 
> -- 
> ===============================================
> Dr. Stephen R. Aylward
> Assistant Professor of Radiology
> Adjunct Assistant Professor of Computer Science
> http://caddlab.rad.unc.edu
> aylward@unc.edu
> (919) 966-9695
>