Hi everyone,
When I use the GUI to adjust the color threshold of an image, I get the results that I desire. Whenever I do this then subsequently click the "Macro" button I get a printout of the auto-generated macro for the color threshold modification.
My problem is that when I run this auto-generated macro on the same image I started with, the end result is different from when I manually adjust the color threshold. The manual protocol results in an image where the particles are colored red for easy counting with the particle analyzer. When I run the automated version of the protocol in my macro, the resulting picture is almost completely white.
Any help would be greatly appreciated. Here is the macro:
open(currentImage);
run("Invert");
run("Color Threshold...");
// Color Thresholder 1.48v
// Autogenerated macro, single images only!
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]=210;
max[0]=255;
filter[0]="pass";
min[1]=0;
max[1]=255;
filter[1]="pass";
min[2]=170;
max[2]=170;
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);
close();
}
selectWindow("Result of 0");
close();
selectWindow("Result of Result of 0");
rename(a);
// Colour Thresholding-------------