Hello !
I would like to find the maxima of an array of images.(any image is black with two spots bright. All in gray scale).
So I've compiled this Macro***. In 2 words, you select a directory in which there are about 300 TIFF files and the macro gives me the maxima positions.
Now I would like that for ANY image, the position of the two maxima were saved in a ONE only text file. For example in a .xls . How could I do?
Is there a method for calculate (ONLY if the maxima are TWO) directly the distance between this two points and finally get ONE file text with all the distances?
Best Regards

Enrico Punzo
***
dir = getDirectory("Choose a Directory ");
setBatchMode(true);
count = 0;
countFiles(dir);
n = 0;
processFiles(dir);
//print(count+" files processed");
function countFiles(dir) {
list = getFileList(dir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/"))
countFiles(""+dir+list[i]);
else
count++;
}
}
function processFiles(dir) {
list = getFileList(dir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/"))
processFiles(""+dir+list[i]);
else {
showProgress(n++, count);
path = dir+list[i];
processFile(path);
}
}
}
function processFile(path) {
if (endsWith(path, ".tif")) {
open(path);
File.open(result.txt)
run("Find Maxima...", "noise=25 output=[List] ");
File.append(row, getDirectory("home")+"results.xls");
save(path);
close();
}
}