Know thy Image Part 2: Image Histograms

In the last post, we looked at the following image to decide if an intensity of 2000 at the tip of the arrowhead was bright or dim. Without knowing the bit depth of the image it’s impossible to tell.

Bright or not bright?

We posed that if this was a 12bit image, that’s fairly bright (2000/4096) but if it’s a 16bit image, then it’s very dim (2000/65536). But why would these two conditions look the same? The answer lies in the histograms and transfer functions…

Taking a closer look at the image histogram

An image histogram simply displays the distribution (or frequency) of intensity values in an image. Somewhat predictably, a photo (this is the same one as used in Part 1) with a full range of grey values will have a histogram to reflect that:


While an image taken on a fluorescence microscope (such as the one at the top of the post) will have a very different looking histogram.

In the latter example, the tall peak towards the left (darker shades of grey) represent the background in the image. The peak is to tall because of the high number of background pixels in the image (we only have one cell after all). The “image data” (it’s all data really) forms the shoulder to the right of the background peak.


Adjusting the display range

Many pieces of software let you adjust the display range of your image (although it’s called lots of different things: Levels, Brightness & Contrast, Transfer Function etc.). With this, you can (non-destructively) change the way the image intensity is displayed. As an example, you can make your image brighter:


Here the red line represents the scale of the original image, while the green line represents the full scale (1-256) of the new image. The bit depth hasn’t changed, but intensity values are effectively doubled and appear brighter because of it (remember that 256 is pure white).

In practical terms, what this means is that you can have two images that appear the same brightness but have radically different transfer functions:


Reset the transfer functions to “Full Range” and you see the “true” intensities:


A Journey into Pre-Acquisition (gasp!)

All of this is important because during and even before acquisition, many people use Autocontrast (or an equivalent function) to set the upper and lower intensity range equal to the Minimum and Maximum intensity of their field. No problem there and in fact, it’s helpful if you’re trying to set up your acquisition parameters.

The problem lies when you see an image that looks good and decide that those settings work without consulting the histogram. This way you can easily end up  in the situation above, using a small fraction of your dynamic range and not realise it until you go to quantify your data.

And herein lies today’s lesson: when acquiring images, you should aim to use as much of the dynamic range as possible without saturating your image (that is, extending beyond the range). This will spread your intensity values out, giving you the most detail.

3 thoughts on “Know thy Image Part 2: Image Histograms

  1. Pingback: Know thy Image Part 1: Bit Depths | Post-Acquisition

  2. Aaderemy

    Thanks for the great job which put into this post.
    My question is how do you practically adjust your dynamic range, which I believe must be done pre-acquisition using the histogram as a sort of compass? For instance, in double-labeling, do you keep increasing the laser power and offset? Many thanks, Dave.



    1. Dave Mason Post author

      Hi Remy, thanks for your comment. Indeed, you need to set the dynamic range of your image during acquisition, but the required levels will depend a lot upon your experiment.

      A (very) general rule of thumb is to try to aim for about 2/3 of your dynamic range, so ~170 counts on an 8-bit range, or ~45,000 counts in a 16 bit range. This should give you lots of levels to work with while also being robust if you find an area of your sample with brighter or dimmer signals. The most important thing is to avoid saturation.

      Hope that helps!




Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.