Min/max reset by moving channel slider if bit range not set to automatic

Hi all,

I think I’ve found a weird bug (unless it’s somehow intended behaviour and I don’t understand the logic). Basically, if you have the 16-bit range set to something that is not “Automatic”, you can get odd behaviour where the min and max settings are reset when you move the channel slider.

The background of this is a lot of our users use μManager to capture their images. If you open an ome.tiff made in μManager in FIJI while on “Automatic” the appearance is set so that the min and max will go to the minimum and maximum value found in the image. This means our users then open their positive and negative images and are immediately worried because they look the same (what they are missing is min/max are 100-12000 and 50-200 respectively).

To get round this we tend to tell to first go to Edit>Option>Appearance and set the bit range to the bit-depth of the camera they use (usually 14-bit or 16-bit) and then find and set suitable min/max values for their images.

I’ve put a little macro that shows the problem although it does need the user to move the slider before the problem is revealed (as indicated by the print to the log). An additional extra fun thing is that this only happens IF the brightness/contrast window is open so in the below macro if you remove the line run("Brightness/Contrast..."); then this doesn’t happen.

run("HeLa Cells (1.3M, 48-bit RGB)");
call("ij.ImagePlus.setDefault16bitRange", 16);
run("Brightness/Contrast...");
Stack.setChannel(1);
run("Enhance Contrast", "saturated=0.35");
Stack.setChannel(2);
run("Enhance Contrast", "saturated=0.35");
Stack.setChannel(3);
run("Enhance Contrast", "saturated=0.35");

print("Click slider to move channel to see loss of min/max settings");

Edit to add version details:
FIJI 2.0.0-rc-71
ImageJ 1.52p

I’ve never used (or even noticed…) this option, but it looks like it may be behaving as designed.

setDefault16bitRange is a static variable:


so will (or at least can) affect all images - and not just the current one

It looks like, with this option selected, ImageJ will fight to restore the brightness/contrast table to these values and not support efforts to change them.

I think perhaps you need your own custom macro that will loop through channels and set the bit depth, e.g.

exponent = getNumber("Enter camera bit depth", 16)
maxVal = pow(2, exponent) - 1
getDimensions(width, height, channels, slices, frames)
for (c = 1; c <= channels; c++) {
	Stack.setChannel(c)
	setMinAndMax(0, maxVal);	
}

Hey Pete,

Thanks a bunch for your investigation! I’m very surprised I haven’t had complaints about it considering it’s not something that has changed.

Obviously, that macro will definitely work but I am slightly loathed to give our new users, the ones who are really just getting to grips with microscopy, a macro to be used for them to be able to look at their images and see what they saw when they captured. Basically, our message will have to be: “Because we use this specific software for capturing images, the display settings in FIJI won’t work as you have been told they will but just run this every time you open any image to fix it”.

I don’t think it will be worth looking at the capturing side, i.e. if the version of, method of saving or display settings within μManager make some sort of difference to how they open in ImageJ but maybe I’ll check. I would be very interested to know if any other facilities have this same scenario and how they get around it.

Does ensuring the autoscale option is unselected in the Bio-Formats importer help you?

Oh yeah, tried this yesterday.

1 - Due to being Tiffs they aren’t auto opened with Bio-Formats.
2 - If you do use the Bio-Formats Importer then the LUTs are different from when image was captured
3 - Autoscale being off looks like it makes a difference then suddenly it doesn’t. I made this little screen capture for you for demonstration purposes.