What does a click on the Threshold window? Is it possible to Record it in a macro

Hi All,
I want to know what does a “click” on the minimum setting of the threshold window. Does it select the next intensity value in the image or a certain percentage of pixel. Is it possible to write in a macro : “Set Threshold 0-255 and 2 clicks on the minimum” ???
Thank you


What do you mean by “click”?? Clicking on what exactly?

If you want to learn more about the Threshold command and options… read this section of the ImageJ User Guide. This should explain all the functionality.

If you want to set the threshold in a macro… you can use this command:

setThreshold(0, 255);
If you want to use the auto-thresholding ‘Minimum’ method, then use:

Searching through the Built-In Macro Functions list is the best way to find these code calls…

Sorry for not being clear.

I use automatic segmentation on images treated to do mask and this segmentation is better if I click twice on the upper slider. I want to be able to write it in a macro.
When you click on the upper slider to set the minimum threshold, this threshold is moved toward the maximum value of the histogram.
I don’t understand by which quantity the minimum threshold is moved up (a proportion of the histogram or the next intensity value, maybe !!!).
Thanks for your help


I see what you mean. For me - they move in 10-level increments. The initial number is set automatically… which is what you want. Ideally - you wouldn’t have to move the settings at all when using automatic thresholding. Perhaps there is another thresholding method that will be better for your images? You can test them all using Auto-Threshold and enabling Try All.

Too - you can use the code call getThreshold(lower, upper) after setting the threshold automatically… then increment the lower value by 20 (which assumes yours also increases by 10-increments per ‘click’) and reset the threshold by calling setThreshold(lower, upper) with the newly-changed lower value.