Watershed Algorithm source - bug
Posted by
David Pont on
Mar 24, 2011; 10:16pm
URL: http://imagej.273.s1.nabble.com/Watershed-Algorithm-source-bug-tp3685192.html
I recently found source code for the Watershed Algorithm Plugin for ImageJ at the RSB web site
For the record -
After a google search I found a link to the source on a Wikipedia page:
http://en.wikipedia.org/wiki/Watershed_%28image_processing%29which linked to a page hosted at the RSB web site here:
http://rsbweb.nih.gov/ij/plugins/watershed.htmlI ported the code to Python and carried out some tests by processing the same input image through ImageJ and my code. I found a bug which caused incorrect location of watershed boundaries.
The bug appears in the original Java code I obtained from the RSB site. It seems likely that it has been found and fixed earlier, as it does not manifest in ImageJ. I suppose the code I got from the RSB site is out of date with respect to the current code for the Watershed Algorithm plugin in ImageJ.
The bug is fixed by changing line 160 in Watershed_Algorithm.java
from:
if( (q.getDistance() <= curdist) &&
to:
if( (q.getDistance() < curdist) &&
regards, Dave
________________________________
This e-mail and any attachments may contain information which is confidential or subject to copyright. If you receive this e-mail in error, please delete it.
Scion does not accept responsibility for anything in this e-mail which is not provided in the course of Scion's usual business or for any computer virus, data corruption, interference or delay arising from this e-mail.