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:

2015-03-24-bits05

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.

2015-03-24-bits13

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:

2015-03-24-bits07

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:

2015-03-24-bits10

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

2015-03-24-bits12

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.

Advertisements

One thought on “Know thy Image Part 2: Image Histograms

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

Comment!

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

WordPress.com Logo

You are commenting using your WordPress.com 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.