[Insight-developers] Fixed bug in Danielsson filter

Mark Foskey mark_foskey@unc.edu
Tue, 04 Mar 2003 14:46:41 -0500


There was a bug in the DanielssonDistanceMap filter -- the current 
offset was compared with the neighboring offset itself, rather than 
with the result of incrementing neighboring offset by the difference 
between the neighboring and current pixels.  The error can be seen in 
the output of the test program:

     0	    0	    0	    0	    0	    0	    0	    0	    0	
     0	    5	3.60555	3.16228	    3	3.16228	3.60555	4.24264	    0	
     0	    4	2.82843	2.23607	    2	2.23607	2.82843	3.60555	    0	
     0	    3	2.23607	1.41421	    1	1.41421	2.23607	3.16228	    0	
     0	    2	2.23607	    1	    0	    1	    2	    3	    0	
     0	    1	1.41421	1.41421	    1	1.41421	2.23607	3.16228	    0	
     0	    0	    1	    2	    2	2.23607	2.82843	3.60555	    0	
     0	    1	1.41421	2.23607	3.16228	3.16228	3.60555	4.24264	    0	
     0	    0	    0	    0	    0	    0	    0	    0	    0	

The value 5 at (1,1) is supposed to be the Euclidean distance to the 
pixel labeled 0 at (4,4).  The errors become more appreciable if you 
are interested in the offsets themselves.  The offset given for (1,1) 
is [0,5], which is completely wrong.

There was also a small problem with the progress reporting.

I have fixed these problems, but I thought I should point this out 
since I know there are people in our group who have been using this 
filter and will want to make sure the bug hasn't been causing problems 
with the results.

-- 
Mark Foskey    (919) 843-5436  Computer-Aided Diagnosis and Display Lab
mark_foskey@unc.edu            Department of Radiology, CB 7515, UNC
http://www.cs.unc.edu/~foskey  Chapel Hill, NC  27599-7515