Search code examples
imagej

what are the default arguments for setAutoThreshold() in batch mode?


I hope you can help me, and that this is the appropriate forum to ask (I have tried on the group letter, but it didnt seem like my message was forwarded). I have inherited some code, which I would like to rewrite. The code consists of a macro that has batchmode set to true, and calls setAutoThreshold(). I have only found setAutoThreshold with 5 different signatures as a method attached to ImageProcessor, none of which have void (no input arguments) as signature. I thus suspect that the batchmode or the macro itself sets some default arguments in the background.

What are the defaults for setAutoThreshold (how would I translate setAutoThreshold() to one that setAutoThreshold(ARGUMENTS_HERE)? and it works on the imageProcessor of the current image?


Solution

  • The macro documentation describes the arguments that can be used:

    setAutoThreshold() Uses the "Default" method to determine the threshold. It may select dark or bright areas as thresholded, as was the case with the Image>Adjust>Threshold "Auto" option in ImageJ 1.42o and earlier. See also: setThreshold, getThreshold, resetThreshold.

    setAutoThreshold(method) Uses the specified method to set the threshold levels of the current image. Use the getList("threshold.methods") function to get a list of the available methods. Concatenate " dark" to the method name if the image has a dark background. For an example, see the AutoThresholdingDemo macro.

    If you're interested in how the thresholds are calculated, the default AutoThreshold method is explained in the ImageJ FAQ and the documentation wiki. You can also read the source code to find out how the calculations are done.

    I hope this answers your question. You might also try the ImageJ forum.