The problem is that the macro recorder can be misleading at times. Let me illustrate. I made a small change to your macro to use script parameters to specify the directory. I am entering the script between two sets of three backtics to keep the upload from changing characters (your paste added unicode characters I needed to strip out). Here is what I used:
@String(label="Image Directory", style="") img_dir
path = img_dir + "/001_003_5_11.tif";
open(path);
makeRectangle(0, 0, 1024, 661);
run("Crop");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(0, 52);
setOption("BlackBackground", false);
run("Convert to Mask");
// run("Close");
I commented out the last run("Close")
to keep the processed image open. This is what I got:
I’m sure this is not what you wanted. The macro recorder had commented out the threshold you wanted
//run(“Threshold…”);
//setThreshold(0, 52);
and just run the default AutoThreshold. When I un-comment those lines and run again,
this uses what the default autothreshold actually measured on this image. Then I got the following image:
Which is what I suspect you really wanted. I played around with some of the other options.
Try this on your series:
@String(label="Image Directory", style="") img_dir
path = img_dir + "/001_003_5_11.tif";
run("Close All");
open(path);
makeRectangle(0, 0, 1024, 661);
run("Crop");
setAutoThreshold("Intermodes");
getThreshold(lower, upper);
run("Convert to Mask");
Hope this helps.
Best regards,
John Minter