imagej / ImageJ

Public domain software for processing and analyzing scientific images
http://imagej.org
Other
556 stars 221 forks source link

Analyze Particles creates unexpected measurement #211

Open schmiedc opened 1 year ago

schmiedc commented 1 year ago

I created a macro to just count objects in a binary image. For this I add the objects to the ROI manager and read out the number of ROIs. The number of ROIs are then added to the result table.

However I noticed that apparently Analyze Particles creates per ROI a measurement. As far as I can tell I did not select any measurement options.

I used Fiji on Ubuntu 22.04.

Here is a macro that reproduces that issue:

` run("Set Measurements...", " redirect=None decimal=3");

run("AuPbSn 40");

setAutoThreshold("Default dark no-reset"); //run("Threshold..."); //setThreshold(126, 255); setOption("BlackBackground", true); run("Convert to Mask"); run("Analyze Particles...", "show=Nothing add");

result = roiManager("count");

setResult("count", 0, result); `

It then produces this result table:

1 41 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0

It does not come from the ROI manager as when I just add ROIs manually to the ROI manager these measurements are not created. Selecting "clear results" in the particle analyzer does not fix the issue.

For me this behavior was surprising. Mind also that without writing the ROI manager count in the results table the 0 measurement per ROI is also not visible actually. As no results table is opened. Further indicating for me that this was unintentional and maybe erroneous measurements are created in the background.

There are other ways I can get the same workflow going. Maybe I overlook also a setting.