imagej / imagej2

Open scientific N-dimensional image processing :microscope: :sparkler:
https://imagej.net/
BSD 2-Clause "Simplified" License
1.2k stars 337 forks source link

Problem with Watershed #299

Closed Pantelispanka closed 3 years ago

Pantelispanka commented 3 years ago

I am using ImageJ in a web application where i have to count some particles. There when i use the watershed the algorithm segments the background and not the particles.

The imports


import ij.ImagePlus;

import ij.plugin.filter.EDM;

import ij.process.AutoThresholder;

The code goes


            ij.plugin.filter.EDM edm = new EDM();

            this.imagePlus.getProcessor().autoThreshold();

            this.imagePlus.updateAndDraw();

            edm.setup("watershed", this.imagePlus);

            edm.toWatershed(this.imagePlus.getProcessor());

            this.imagePlus.updateAndDraw();

I use autoThreshold because of the 0-255 binary image asked from the watershed algorithm. That alters everything from the pipeline but even though the algorithm returns segmented the background and not the particles

imagejan commented 3 years ago

This is not an imagej2 issue, I believe.

The best place for questions/issues like these is actually the forum: https://forum.image.sc

@Pantelispanka please try whether changing the Black background option in Process > Binary > Options... helps.

Pantelispanka commented 3 years ago

Thanks for pointing that out. I will close the issue and post it on the forum.