Hi,
I have read a interesting article about using watershed to do segmentation by Steve of Mathworks: http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-from-tech-support/ I want to use ImageJ to perform the same task on the same image in the article. I use the watershed plugin of ImageJ, and the operations is like http://rsb.info.nih.gov/ij/plugins/watershed.html describes: "invert image (Edit/Invert), calculate the distance transform (Process/Binary/Distance Map), invert result, apply Watershed." However, after calculating the distance transform, the result image is not a BINARY image, so I can't apply the watershed filter. Am I operate wrong? Any suggestions? And, Matlab's watershed commands: L = watershed(A); Lrgb = label2rgb(L); L is a label matrix identifying the watershed regions of the image A. Can I get this representation by ImageJ? Also, Matlab command "label2rgb" can color regions in different colors, how can I accomplish this in ImageJ? Thanks! -- Yili Zhao -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Thursday 03 Apr 2014 16:37:11 you wrote:
> Hi, > I have read a interesting article about using watershed to do > segmentation by Steve of Mathworks: > http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-fro > m-tech-support/ > > I want to use ImageJ to perform the same task on the same image in the > article. > > I use the watershed plugin of ImageJ, and the operations is like > http://rsb.info.nih.gov/ij/plugins/watershed.html describes: "invert image > (Edit/Invert), calculate the distance transform (Process/Binary/Distance > Map), invert result, apply Watershed." > > However, after calculating the distance transform, the result image is > not a BINARY image, so I can't apply the watershed filter. Am I operate > wrong? Any suggestions? You need to apply the original watershed algorithm which works on greyscale, not the one built in IJ (which really should be called "Watershed separation" or something like that). Daniel Sage has one plugin to do this in his page. http://bigwww.epfl.ch/sage/soft/watershed/ You want the Watershed Dams. Below is an example of how to call Daniel's plugin to only get the dams, and the Extended Minima can be computed with a macro from the Morphology collection here: http://www.mecourse.com/landinig/software/software.html ==================================================== import ij.*; import imageware.*; import watershedflooding.*; import ij.gui.*; /** * 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 * * modified by G. Landini to use min and max * */ public class WatershedDams_ { public WatershedDams_() { int minLevel =0;// (int) gd.getNextNumber(); int maxLevel =255;// (int) gd.getNextNumber(); boolean connectivity4 = false; //gd.getNextBoolean (); // false=8 // Get the input image ImagePlus imp = WindowManager.getCurrentImage(); if (imp == null) { IJ.error("No 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); watershed.doWatershed(image, connectivity4, minLevel, maxLevel); ImagePlus dams = watershed.getDams(); dams.show(); } } ==================================================== -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by panovr
Hi Gabriel,
thanks for this plugin information, and the plugin does what I need! I wish I know this plugin before I post the question :) -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |