|
Hi List,
I've noticed that when I try to use 'Li' thresholding (via setAutoThreshold) using a macro or plugin, I get a different result than when I run it manually. For example, I have some code which I generated by using the macro recorder:
run("Duplicate...", "title=mask");
mask = getImageID();
run("16-bit");
run("Gaussian Blur...", "sigma=1");
run("8-bit");
run("Variance...", "radius=2");
setAutoThreshold("Li dark");
run("Convert to Mask","");
run("Fill Holes");
Which gives me a reasonable threshold for my particular image.
However, if I copy and paste this code into a new macro window (via Plugins-->New-->Macro) and then run it, the threshold now selects the entire image and is completely different than when I did it step-by-step. If I stick an "exit()" command after the variance command:
run("Duplicate...", "title=mask");
mask = getImageID();
run("16-bit");
run("Gaussian Blur...", "sigma=1");
run("8-bit");
run("Variance...", "radius=2");
exit();
setAutoThreshold("Li dark");
run("Convert to Mask","");
run("Fill Holes");
and run the code, I can then go to Image-->Adjust-->Threshold..., select 'Li' from the drop-down menu, select 'Dark Background', and observe the correct threshold.
Anybody know what's going on?
Thanks,
Adam
=====
Science is more of an art than a science.
|