|
Hi to all!
I'm new to this forum, but read it for some time.
I want to perform batch cell counting on fluorescence images. The Problem is, to find the right threshold algorithm. The best i figured out yet is the "Moments" algorithm from the "AutoThresholder" plugin.
I wrote a batch macro to count all cells in the images, but the algorithm have problems on pictures with no cells (there it counts thousands of artefacts from thresholding). My idea was, if the mean grey value in a picture is below a certain value, the picture is thresholded manually by the user. But i get every time the error message "There are no pictures open". What's wrong? Any other Ideas for the right algorithm?
macro "Threshold_Moments_rot"{
dir = getDirectory("Choose a Directory ");
list = getFileList(dir);
setBatchMode(true);
for (i=0; i<list.length; i++) {
showProgress(i, list.length);
open(dir+list[i]);
getRawStatistics(nPixels, mean, min, max, stdDev);
if (max<=3)
run("Split Channels");
close();
close();
setThreshold();
run("Invert")
run("Analyze Particles...", "size=5-infinity circularity=0.00-1.00 show=[Overlay Outlines] display summarize record add");
else
run("Split Channels");
close();
close();
run("Auto Threshold", "method=Moments white");
run("Invert");
run("Analyze Particles...", "size=5-infinity circularity=0.00-1.00 show=[Overlay Outlines] display summarize record add");
close();
}
}
Best regards,
Robert
|