Re: Find Maxima ... segmentation (macro issue)

Posted by Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Find-Maxima-segmentation-macro-issue-tp5023746p5023749.html

Hi Christian,

as Gabriel said, please provide a sample image where the results of the
manual and macro operations are different.

I agree that "Find Maxima" with output type "Segmented Particles" should
be usable as a marker-based segmentation if the marker pixels have
values that exceed the background by the the prominence or more.
If you also have a threshold ("Above lower threshold"), the markers must
have higher values than the surrounding pixels, and the background must
have pixel values below the lower threshold.
Here is a macro example that works for me (it uses the output of a
rather strict "Find Maxima" as seeds and adds it to the original image:

   run("Blobs (25K)");
   run("Multiply...", "value=0.5");
   run("Find Maxima...", "prominence=85 light output=[Single Points]");
   imageCalculator("Add", "blobs.gif","blobs.gif Maxima");
   selectWindow("blobs.gif");
   setThreshold(38, 255);
   run("Find Maxima...", "prominence=128 above light output=[Segmented
Particles]");


Concerning:
 > Could I run the "Find Maxima..." segmentation from the macro in Java
or JS as a workaround / for testing?
You can simply replace the "run" of a macro by "IJ.run" in java or
javascript.

macro:
   run("Find Maxima...", "prominence=32768 strict above
output=[Segmented Particles]");
java or javascript:
   IJ.run("Find Maxima...", "prominence=32768 strict above
output=[Segmented Particles]");


To me, it is astonishing that there should be a difference between
interactive operation and "run" from a macro. When running a macro,
ImageJ essentially fills in the parameters into the dialog and then does
the same as in an interactive operation.
Please make sure that the following are the same in both cases:
- threshold
- grayscale calibration ("Find Maxima" uses calibrated values)
- 'normal' or inverted lookup table.



Michael
________________________________________________________________
On 21.07.20 23:16, Christian R. wrote:

> Hi all,
>
> I've run into an issue when running the "Find Maxima..." segmentation algorithm by Michael Schmid:
> Basically, running the segmentation from a macro produces different results than a manual run -
> from the same image, with the same parameters provided.
>
> Parameters: "prominence=32767 strict above output=[Segmented Particles]"
>
> The image is a 500x500 px overlay of nuclei (values: 0, 65535) and cytosol markers (values: 0-32767),
> which, in principle, works as a marker-based segmentation - when run manually.
> But it looks like a marco run produces additional particles, which are lines with a width of single pixels.
> I've tried to exclude those additional particles with the Analyze Particles... with size or circularity limits,
> but unfortunately that also excludes valid results (particles derived from maxima).
>
> Could I run the "Find Maxima..." segmentation from the macro in Java or JS as a workaround / for testing?
> (I've consulted the ImageJ documentation, but unfortunately my understanding of ImageJ is still too limited.)
>
> I'd like to troubleshoot this issue, since it's currently a roadblock in my image processing pipeline.
>
>
> Thanks in advance,
> Christian R.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html