macro 'Batch Image Analysis' {
requires('1.33s');
open('C:\\work\\research\\Projects\\Passive-Starter\\Distribute\\Analysis\\arbitraryimage.tif');
run('Set Scale...', 'distance=1.56 known=1 pixel=1 unit=um global');
close();
run('Set Measurements...', 'area centroid perimeter circularity display redirect=None decimal=3');
dir = 'C:\\work\\research\\Projects\\Passive-Starter\\Distribute\\MultipleTestSamples\\TestSample1\\'
list = getFileList(dir);
setBatchMode(true);   
for (i=0; i<list.length; i++) { 
path = dir+list[i];  
open(path);   
run('8-bit'); 
setAutoThreshold();   
run('Apply LUT');   
run('Fill Holes');
run('Analyze Particles...', 'minimum=4 maximum=9000 bins=20 show=Nothing display exclude');
dotIndex = lastIndexOf(path, '.');
if (dotIndex!=-1)     
path = substring(path, 0, dotIndex); // remove extension  
save(path+'-bin.tif');   
close();   
saveAs('Measurements', 'C:\\work\\research\\Projects\\Passive-Starter\\Distribute\\MultipleTestSamples\\TestSample1\\InfoResults\\ImageJout.xls');
}
}
