1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
input = getDirectory("Choisir le dossier source ");
output = getDirectory("Choisir le dossier de sauvegarde");
function action( input, output, filename) {
open(input + filename);
run("Set Scale...", "distance=167.5 known=1 unit=mm");
run("Color Threshold...");
// Color Thresholder 1.51t
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run("HSB Stack");
run("Convert Stack to Images");
selectWindow("Hue");
rename("0");
selectWindow("Saturation");
rename("1");
selectWindow("Brightness");
rename("2");
min[0]=0;
max[0]=255;
filter[0]="pass";
min[1]=0;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=162;
filter[2]="pass";
for (i=0;i<3;i++){
selectWindow(""+i);
setThreshold(min[i], max[i]);
run("Convert to Mask");
if (filter[i]=="stop") run("Invert");
}
imageCalculator("AND create", "0","1");
imageCalculator("AND create", "Result of 0","2");
for (i=0;i<3;i++){
selectWindow(""+i);
}
selectWindow("Result of 0");
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------
run("Analyze Particles...", "size=0.20-1.00 circularity=0.80-1.00 show=Outlines display clear include summarize");
saveAs("Results", output + filename + ".xls");
//run("Save", "save=[output + "Drawing of " + filename + ".tif"]");
saveAs("Tif", output + filename);
run("Close")
}
setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
action(input, output, list[i]); |
Partager