From Grayscale Image to HiLo Image: LUT range HELP

Hi! I am working with a 32-bit grayscale image. I would like to use a LUT (like the HiLo one) to highlight the differences in greytones. I would like to change the LUT in order to have my greytone 0 corrisponding to one end of the spectrum (blue) and a custom greytone (for example 25) corrisponding to the other end of the spectrum (red). All the other grey tones (26-255) can stay the same or be a fixed value of grey. Then, I would like to build a legend close to the image in the same range (0-25). I find myself unable to do so using the LUT Editor. What should I do?
Thank you for your help.

Welcome to the forum, @Anna1202!

The look-up table (LUT) is simply a mapping that defines how the range between display min and display max intensities is mapped to colors on your screen. In ImageJ, LUTs are always 8-bit, i.e. they have 256 different levels (0-255).

Your image might have a different bit depth, and the B&C dialog (Image > Adjust > Brightness/Contrast…) defines which Minimum value is mapped to 0, and which Maximum value is mapped to 255 of your LUT.

In your case, you’ll want to set the Min to 0 and the Max to 25. If you run the Macro recorder while pressing the Set button of the B&C window, you get the corresponding macro code:

setMinAndMax(0, 25);

Regarding the LUT choice, I recommend the mpl-viridis LUT as it allows to distinguish many intensity levels while being perceptually uniform:

The HiLo LUT differs from the standard grey levels only by setting 0 to blue and 255 to red, all other grey tones are unchanged.

Simply add a calibration bar via Analyze > Tools > Calibration Bar…, as shown here on the M51 Galaxy sample image:


Wow - that was simultaneous @imagejan !!! :slight_smile:

I was going to also link her to this past forum post as another option.

Hope it all helps @Anna1202 !!

eta :slight_smile:

1 Like

yes, it helped a lot! Thank you so much, you are so kind! I am going to try and make this work, thank you for all the help @etadobson !

1 Like

Thank you @imagejan ! That was very very helpful!
I managed to change the image to false colors and I played a bit with the B/C and the LUTs to better display my data.
The only problem is that when I follow you directions for the Legend (add a calibration bar via Analyze > Tools > Calibration Bar…) it gives me a error message “RGB and composite images are not supported”.
That’s kind of sad, and I don’t really understand what the User Guide is trying to tell me. What can I do? Thank you so much for your kind answer, you have saved my thesis :slight_smile:

1 Like