Brightness/contrast minimum slider cannot be returned to zero (loss of dim pixels)

Hi there,

Since reinstalling the latest version of FIJI on my computer the B&C window seems to behave differently. To show you an example, here are two copies of the same image. One is untouched (‘Unadjusted’), and when I select the B&C window the minimum value is zero as I would expect. But when I drag the minimum bar up and back down again (as in the ‘Reverted’ copy of the image), the minimum value changes (in this case to 1449), and the slider cannot be returned to zero. This corresponds to a change in the image (dim pixels become black), and finer structures become invisible.

I am confused about why this is happening without me ever pressing the ‘apply’ button. The ‘reset’ button has no effect. The only way I have found to return the minimum value to zero (and restore all the visual information) is to manually set the minimum value to zero using the ‘set’ button, and then to repeatedly click the left arrow to return the minimum bar to zero (if I drag it with the mouse the minimum value jumps back to 1449). Obviously this is very annoying.

My ImageJ expertise is limited, so I may well be missing something! Hugely appreciate your suggestions.

Thanks for taking the time,
Catherine

I’m pretty sure what you are describing isn’t new behaviour at all. ImageJ automatically sets the min to the minimum value of your image (at least for Tiffs, Bio-Formats imported images can behave differently). I think if you did a CTRL+M on your image you would see you min value is 1449. If not, then I don’t know.

You can set a display range if you go to the “Set” button and set you “Unsigned 16 bit range” to 16-bit. However, the behaviour following that annoys me to be honest which I’ve discussed in this post.

Although, I would have thought if you “Set” the display minimum to zero that should be enough and you shouldn’t have to click the left arrow button at all (let alone repeatedly) so I’m not sure about that behaviour. What kind of file are you looking at?

1 Like

That is correct.

The macro code for this looks like

//** Set the default 16-bit display range, where 'bitDepth' must be 
// 0 (autoscaling), 8 (0-255), 10 (0-1023), 12 (0-4095, 
// 14 (0-16383), 15 (0-32767) or 16 (0-65535). 

call("ij.ImagePlus.setDefault16bitRange", 10);

An example how to add shortcuts to ImageJ by modifying the startup macro can be found here:

1 Like

Thanks heaps @lmurphy and @phaub,

You’re totally right that the value the minimum slider jumps to is the minimum grey value of the image, however it still doesn’t make sense to me why the image actually gets darker when I move the minimum slider up and all the way down again. If the minimum slider corresponds to the minimum grey value in the image then surely the image should not be changed at all?

Setting the bit range to 16-bit instead of automatic does avoid this.

One question about the macro code @phaub - when I open the ‘Set’ button within the B&C window I can see that the macro works to change the value in ‘Unsigned 16-bit range’ to whatever I chose, but it hasn’t actually applied (I still need to click ‘Set’ and ‘Ok’ for it to apply to the image). Is this expected?

Thanks again,
Catherine

I think @lmurphy is right, this should not be a new behavior. But I don’t want to claim that this for sure. Anything can happen. If you still think it is new then please describe the behavior before updating.

This is an important question.
Changing the min and max values in the B&C dialog is “changing the mapping from pixel values to 8-bit display values”. It does not change the pixel values itself but only the display values. The image content is not changed.
‘Apply’ uses the current display range mapping function to modify the pixel data. ‘Apply’ changes the image content!
(see https://imagej.nih.gov/ij/docs/guide/146-28.html for more information)

The image content is mapped to an 8bit display where the min slider value defines the image content value (pixel value) which is set to zero on the display. If you change this min slider value by moving the slider the image looks darker or brighter.

Setting the bit range to 10-bit, 12-bit, or 16-bit is like setting
min=0 and max=1024, 4096 or 65536.
Setting the min and max values to this predefined values doesn’t change the behavior of a subsequent slider movement.

Add one line to the macro to make the changed display mapping visible directly:

//** Set the default 16-bit display range, where 'bitDepth' must be 
// 0 (autoscaling), 8 (0-255), 10 (0-1023), 12 (0-4095, 
// 14 (0-16383), 15 (0-32767) or 16 (0-65535). 

call("ij.ImagePlus.setDefault16bitRange", 10);
resetMinAndMax();
2 Likes

I might be misunderstanding what you mean regarding moving the slider up and down in this post but in your first post the behaviour seemed totally expected to me. I’ve tried to help by making the little schematic below.

image

The bars showing gradients of colour is the look up table that assigns colours to the values in your image. Hopefully, looking it you can see that if your image is set to min = 0, there will be no black (or close to black) colours on your image because we know that there are no values from 0 up to 1448. All the values in your image are 1449 up to 16383 so as you can see on the top spectrum they will all be a gray to white. When the minimum is 1449, it and some values above it will be coloured black because the LUT has essentially been kind of squished. This gives the appearance of a darker image.

Sorry I’ve misunderstanding your post but hopefully this might help.

1 Like

Thank you both for being super helpful!

I do understand how the min-max sliders only change how the image displays and not the pixel values of the image (unless you ‘apply’). My ignorance of the correct terminology may have caused some confusion there - my topic title is misleading with hindsight!

The seeming loss of visual information (by eye, not loss of pixel information) from an untouched image where I could see my fine neuronal processes to an image where I had merely touched the min-max sliders (and tried to return them to where they were before) and could no longer see those structures was concerning me because my main use of the B&C window is for creating figures for humans to look at.

@lmurphy, your schematic and explanation resolves my conceptual confusion, thank you!

I guess that if I don’t want my minimum pixel values to map to black I need to not choose ‘automatic’ for the bit range (being able to adjust the sliders to a point where I could still see all my fine neuronal processes was what I meant when I said setting the bit range to 16-bit ‘avoided’ the problem).

Thank you for the time-saving macro @phaub!

Much appreciated,
Catherine

1 Like