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

Combine selections (OR) command produces incorrect results with fully overlapping ROIs #205

Open dnmason opened 6 years ago

dnmason commented 6 years ago

From: http://forum.imagej.net/t/sum-of-areas-with-the-command-or-combine/11467/3

Combining overlapping ROIs which include a non-primitive shape produces an inaccurate area measure. I would expect a fully overlapping ROI to have no effect on the area measure of the enclosing ROI.

Steps to reproduce (IJ1 code):

roiManager("reset"); run("Clear Results"); close("*"); run("Set Measurements...", "area redirect=None decimal=3"); newImage("example", "8-bit black", 512, 512, 1); makePolygon(82,236,173,138,310,133,427,169,428,347,230,404); roiManager("Add"); makeOval(241, 218, 70, 70); roiManager("Add"); roiManager("Select", 0); run("Measure"); roiManager("Select", newArray(0,1)); roiManager("Combine"); run("Measure");

Note that in my testing a freehand selection appears larger after combining with a fully overlapping oval, while a segmented ROI (as above) appears smaller.