using circularity exclusion on a stack
Posted by Andrew Kligerman on Oct 07, 2005; 4:51pm
URL: http://imagej.273.s1.nabble.com/using-circularity-exclusion-on-a-stack-tp3704712.html
Awhile back someone (I think it was Wayne) helped me include a small
macro to eliminate particles with too little circularity from images in
which I was counting particles. I found I could not use this for a
stack, only individual images. I got around this problem somewhat, by
changing the stack to a montage and then performing the erasure of non
circular particles and then particle analysis. Just wondering why this
would not work on a stack and if I could get it to work. Thanks for any
help. By the way I know no computer language so I just cut and past to
write macros.
Andy
This is the original macro and then the one that does not work:
ORIGINAL
requires("1.29n");
minCircularity = getNumber("Minimum Circularity:", 0.92);
run("Blobs (25K)");
setThreshold(125, 248);
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
show=Nothing clear record");
for (i=0; i<nResults; i++) {
x = getResult('XStart', i);
y = getResult('YStart', i);
circularity = getResult('Circ.', i);
if (circularity<minCircularity) {
doWand(x,y);
run("Clear");
}
}
run("Select None");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
show=Nothing display clear");
THIS IS SOMETHING THAT WORKS WITHOUT A STACK BY CHANGING IT TO A MONTAGE
run("Image Sequence...", "open=C:\\DeangeloNCM480\\test\\Image1.tif
number=9 starting=1 increment=1 scale=100 file=Image");
run("RGB Split");
run("Close");
run("Close");
run("Median...", "radius=3 stack");
for (slice=1; slice<=nSlices; slice++) {run("Set Slice...",
"slice="+slice);
run("Enhance Contrast", "saturated=0.4 normalize ");
run("Threshold", "slice");
}
run("Options...", "iterations=1 ");
run("Fill Holes", "stack");
run("Erode", "stack");
run("Fill Holes", "stack");
run("Watershed", "stack");
run("Options...", "iterations=3 ");
run("Make Montage...", "columns=3 rows=3 scale=1 first=1 last=9
increment=1 border=0");
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum 1 maximum=999999 bins=20
show=Nothing clear record");
minCircularity = getNumber("Minimum Circularity:", 0.80);
for (i=0; i<nResults; i++) {
x = getResult('XStart', i);
y = getResult('YStart', i);
circularity = getResult('Circ.', i);
if (circularity<minCircularity) {
doWand(x,y);
run("Clear");
}
}
run("Select None");
run("Analyze Particles...", "minimum=300 maximum=1100 bins=100
show=Nothing display clear");