Analyze Particles with "Exclude On Edges" with Complex ROI Fails Oddly

Hi all,

While trying to run the good old Analyze Particles command on some data, we get a strange behavior of we run:

  • Exclude on Edges.
  • With an ROI on the image that has multiple holes.

The result seems to exclude particles around an nonexistent edge that links the two holes together

To replicate the effect (on Fiji with ImageJ 1.52n) you can download the following image
Raw Adipocytes analyse bug edges.tif (696.7 KB)

And apply the following macro

setAutoThreshold("Huang dark");
setAutoThreshold("Default dark");
run("Analyze Particles...", "  show=Masks exclude");

This is the original image, note that the ROI is the entire image MINUS the two circles

The result is


Which is for some reason excluding particles in a line connecting the two holes.

Any help figuring this out is appreciated.

Oli

:face_with_raised_eyebrow: :crazy_face: :scream:

Until this gets fixed, you can do this via reconstruction.
I renamed your image to Ori.tif, and this macro does what you want (you will need the Morphology plugins) (via my page or the Morphology update site in Fiji).

roiManager("Add");
run("Duplicate...", "title=seed");
run("Select None");
run("Set...", "value=0");
roiManager("Select", 0); //load back the ROI
setForegroundColor(255, 255, 255);
run("Fill", "slice");
run("Select None");
run("Invert");
run("Add Borders", "top right bottom left white");
run("BinaryReconstruct ", "mask=Ori.tif seed=seed create white");
imageCalculator("Subtract create", "Ori.tif","Reconstructed");

You would obviously need to modify this if you are processing more images but might give you some ideas.