Login  Register

Re: need help on various watershed segmentation algorithms

Posted by Gabriel Landini on Dec 28, 2007; 12:12pm
URL: http://imagej.273.s1.nabble.com/need-help-on-various-watershed-segmentation-algorithms-tp3697689p3697693.html

On Friday 28 December 2007, Chris Clarin wrote:
> 1) process->binary->watershed

That is not the traditional "watershed", but perhaps it should be
called "watershed separation". It separates  touching binary blobs. It finds
the watershed of the euclidian distance map of the blobs.

> 2) process->binary->Distance Map->daniel sage's plugin (Watershed
> Algorithm)

> 3) blur->binary->Distance Map->daniel sage's plugin (Watershed
> Algorithm)

In principle same thing as above?

I am not sure what you want to do but Daniel's plugin should work on the
greyscale images or on gradient images rather than first converting to binary
and then doing the EDT. Of course it depends what you want to do.

I found this paper to be very informative:
Watersheds in digital spaces: an efficient algorithm based on immersion
simulations.  Vincent, L.; Soille, P.  Transactions on Pattern Analysis and
Machine Intelligence  Volume 13, Issue 6, Jun 1991 Page(s):583 - 598

The plugin below is an example to call the Daniel's watershed class and
display only the dams.

Cheers,

G.



//-------------------------------------------------
import ij.*;
import imageware.*;
import watershedflooding.*;

/**
* Class MacroWatershed_.
*
* Easy example of calling watershed methods.
*
* @author Daniel Sage
* Biomedical Imaging Group
* Swiss Federal Institute of Technology Lausanne
* EPFL, CH-1015 Lausanne, Switzerland
*/

public class WatershedDams_ {

        public WatershedDams_() {
               
                // Get the input image
                ImagePlus imp = WindowManager.getCurrentImage();
                if (imp == null) {
                        IJ.error("No open image.");
                        return;
                }
               
                if (imp.getType() != ImagePlus.GRAY8 && imp.getType() != ImagePlus.GRAY32) {
                        IJ.error("Require a 8-bit or 32-bit image.");
                        return;
                }
               
                ImageWare image = Builder.wrap(imp);
               
                // Start the watershed segmentation
                boolean displayProgressionMessage = false;
                Watershed watershed = new Watershed(displayProgressionMessage);
               
                boolean connectivity4 = false;//8
                int maxLevel = 255;
                watershed.doWatershed(image, connectivity4, maxLevel);
               
                // Available outputs
                ImagePlus dams = watershed.getDams();
                dams.show();
        }
}


//-------------------------------------------------