Lab Contents

This is exercise is a bit involved and awkward to do, so I've made it optional. There are tips on how to look at individual pixels, and zoom small windows. A discussion of false color is at the end.

Pixel Information

Gray Levels and the Look Up Table

Load very small image. Zoom. Examine individual pixels. Image LUT and thresholding issues.

Gray Levels (Intensity Levels)


This window is so small that the close box and zoom box appear on opposite sides of the title bar.



The title can be read in the title bar, but the window must be zoomed to be useful.



The image should now look like this:



The image will look somewhat like this, that is. The shades of gray are limited on my PC resulting in the two wide vertical stripes with the greenish shade appearing on my screen as an artifact. Your computer may be different. The band down the middle of the Mac image is the result of reducing the gray levels when making the .gif file.

Each of the horizontal bands in the image is one pixel wide, as far as the image data is concerned. The image is zoomed by replicating the pixels so that one image pixel appears (here) as a 16 x 16 pixel square on the screen.

The horizontal bands are a good illustration of the Mach Bands illusion - the 16 bands are uniform - NOT shaded top to bottom. The jump of 16 intensity units from one to the next appears as a sharp line. The bands ARE shaded left to right, but the eye cannot discern changes in intensity or gray level that are this small.




   This was taken with the cursor on the 6th pixel in the top row. Its actual value is 6. The new value (249) is 255 - 6, and corresponds to the brightness displayed in the window.

   This is the Info for the same pixel with the Invert Pixel Values box NOT checked.



The almost vertical line in the map window and the Lower and Upper limits in the Info window correspond to the short section in the LUT window that is the compressed gray level ramp. All the other brightness levels are now saturated white or black.

The contrast in the mid section of the image is now great enough to see the individual pixels.

Info for cursor at arrow.


False Color (Pseudocolor)

Contrast enhancement and thresholding (below) are special cases of false color. See also the False Color exercise.

Brightness and contrast adjustments are special cases of altering the Look Up Table (LUT), that is of changing the correspondence of image pixel value (0 - 255) to display intensity or color. The LUT can be thought of as a table with 256 rows (one row for each pixel intensity) and 3 collumns (one collumn for each of the three primary colors, Red, Green and Blue).

As shown above, the LUT is shown graphically (gray scale images only) in the Map window, and as a gray level or color bar in the LUT window with levels at the cursor read in the Info window.

The default for the LUT: this for many image processing programs ...


Idx.. red
 0  0  0  0
 1  1  1  1
 128  128  128  128
 129  129  129  129
 130  130  130  130
 131  131  131  131
 254  254  254  254
 255  255  255  255

 ... and is this for Image.

  • (Check this by moving the corsor over the LUT window, and observing the Info window).

 0  255  255  255
 1  254  254  254
 128  127  127  127
 129  126  126  126
 130  125  125  125
 131  124  124  124
 254  1  1  1
 255  0  0  0

 When the contrast was greatly increased in the example above, the LUT was changed to this:

Most intensity values are shown either as white or black. Those in the narrow range of 119-136 are given evenly spaced brightness

 0  255  255  255
 1  255  255  255
 128  120  120  120
 129  105  105  105
 130  90  90  90
 131 75  75  75
 254  0  0  0
 255  0  0  0


You are given ALMOST full control of the LUT values. Two, namely 0 and 255, are fixed. (NIH Image Manual, p. 24: The first (0) and last (255) entries in the LUT, which are always white and black respectively, are never inverted since these entries are used for drawing the menu bar, title bars, dialog boxes, etc.). This minor limitation will be dealt with later.

The default LUT for Image, LUT Table B above, is inverted from what many are used to, with zero being white and 255 black. The obvious thing to do, then, is to invert (turn upside down) the LUT.

Note - the Invert box denotes a one-time operation and not the status of the LUT -- the LUT will remain inverted until another color scale is selected, but opening this window again will show the box NOT checked. Checking it and clicking OK will invert the table again, restoring the default values.

The Options->Grayscale menu will also restore the default values

After inverting the LUT, the image will look like this - which is normal except for the two pixels corresponding to the two LUT values which cannot be changed.


Thresholding issue

Thresholding, which is used for counting and sizing particles, is done via the LUT tool. Since two LUT values (0 and 255) are not accessable, pixels with these values cannot be selected:

 Note that the two 'problem pixels' cannot be selected.

This problem shows up in some images where the objects to be counted have pixels with one or the other of these values. Without taking the steps below, the objects will have 'holes' where the problem pixels are.

To make the image look normal with this inverted LUT, eliminate the values of 255 and zero with these two steps:

After these two operations, the 'out of place' white and black pixels will not be there, because the once white pixel now has a value of 1 (like the pixel just to its right) and the black pixel now has a value of 254 rather than 255. Also, the entire image can be selected with the thresholding tool.


Another operation that gives the same appearance as the inversion above, but without the misplaced pixels is to invert the pixel values (subtract them from 255.

The image will ramp from black at the top to white at the bottom, but now the values have been subtracted from 255.

Whatever scheme used depends on whether you are interested in appearance of the image or in the numerical intensity values.