Why are these thresholding methods different?

If I go to “adjust threshold” and set the threshold between e.g. 0 and 1500 for B/W, and a suitable method from the dropdown I get one type of result. But for some reason, this thresholding reverts back to default after doing particle analysis.

So, if I want to make the thresholding “permanent” (so I can do many types of analysis without having to set the threshold over and over) I set the same parameters, this time through using the “apply” button in the adjust threshold window. However, this gives me an entirely different outcome, which generally contains a lot more black.

Why are these two methods different?

@komodovaran

Do you mean to say that there is a different outcome between hitting the “apply”-button and the “set”-button in the threshold menu. (The menu that is accessed with Ctrl+Shift+T?)

Yeah. The ideal thing about the Ctrl+Shift+T threshold box is the live preview, that allows me to accurately set the threshold I need. If I hit “apply” afterwards I get an entirely different outcome with no live preview.

I was just checking the thresholding in Fiji and could not reproduce the error. Can you maybe give a walk through of your steps?
What method of thresholding did you select?
You are using 16-bit images?
Are you segmenting a whole stack of images at the same time?

More information about the different methods can be found here, but i doubt this will solve the error:

Edit: Updated to the latest version of Fiji?

1 Like

The inconsistency between threshold display and the resulting binary image from 16-bit images was discussed before:

As explained in @Wayne’s answer here, the Threshold dialog only modifies the current lookup table (LUT) to get a quick and approximate display of the current threshold settings. In ImageJ, LUTs are always 8-bit, so there can be a mismatch between the lowest thresholded bin of the 8-bit LUT and the actual threshold value in the 16-bit range.
(I remember having read some explanation on Fiji’s bugzilla bug tracking system in the past, but bugzilla is unavailable at the time of this writing…)

E.g. if you have a 16-bit image with intensities 0-65535, it will be displayed in 256 (=8-bit) intensity bins (0-255, 256-511, 512-767, …, 65280-65535). If your current threshold value is 328, all pixels in the 256-511 bin will be shown red (or white) in the preview, but only pixels that are really above 328 will be white in the result image after applying the threshold.

To illustrate this, compare the following two macros:

  1. This will display the thresholded LUT:
run("M51 Galaxy (177K, 16-bits)");
setAutoThreshold("Huang dark");
  1. This will apply the threshold and therefore have less foreground pixels:
run("M51 Galaxy (177K, 16-bits)");
setAutoThreshold("Huang dark");
setOption("BlackBackground", true);
run("Convert to Mask");
9 Likes