Posted by
Christopher Coulon-2 on
Oct 15, 2015; 6:21pm
URL: http://imagej.273.s1.nabble.com/Only-count-cells-that-contain-nuclei-or-holes-in-the-binarized-image-tp5014654.html
This macro utilizes the analyzeParticles routine with and without the “include holes” option.
// intended for the binary image
setAutoThreshold("Default");
run("Set Measurements...", "area redirect=None decimal=5");
run("Analyze Particles...", "size=100-Infinity display exclude clear");
noHoles = newArray(nResults);
holes = newArray(nResults);
for (i = 0; i < nResults; i++) noHoles[i] = getResult("Area", i);
run("Analyze Particles...", "size=100-Infinity display exclude clear include");
print("Particles Containg Holes");
for (i = 0; i < nResults; i++) {
n = i+1;
holes[i] = getResult("Area", i);
a = holes[i] - noHoles[i];
if(a > 0) print(n + " area of hole = " + a);
}
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html