I just stumbled upon this weird issue working in Fiji on images with a modified non-linear grayscale LUT (gamma compressed, in my particular case). After saving an image with this modified (but not applied) LUT and reloading it, the image defaults to the standard “grays” LUT.
Here’s a quick visual example (with a really obvious modification to the LUT):
Here’s a sample image (as .png, see below) so you can reproduce this behavior:
As far as I could test it, this behaviour:
extends to 8-bit, 16-bit, and 32-bit images (single images, or stacks), but does not happen on multichannel images (even when all channels have grays-only LUTs).
only happens when all the colors in the LUT are shades of gray (i.e. R=G=B). A single change for a non-gray value and all behaves as expected. It neither happens for a non-linear monochrome color LUT (i.e. two components of the RGB triplet are zero). The only exception to this appears when the whole linear LUT has been inverted (255 to 0), in which case the LUT gets saved with the image, and the “inverting LUT” text appears when reopening it.
takes place at the “Save…” stage (as opposed to being an “Open…” issue). The checksums of a “grays” original image, and the just-saved non-linear LUT version match.
The issue does not happen when saving through the BioFormats exporter ( .ome.tif or .tif). [On a side note, this brings a second unrelated issue: a scale is added where there was none (and different for each extension)]. The issue does not happen either when saving to .png (8-bit files only), but appears when saving from this .png file (which preserves the bitmap values and the non-linear LUT) to .tif.
I could test it on the current version of Fiji (1.52i) and an older plain ImageJ version (1.49k, 2014?), so it does not seem like a recent change.
Is this an expected behaviour, or is it a bug?
Thank you all for your time!