Initial Publication Date: May 1, 2010

Moved from Week 2

An important concept here is that storing all this information in an image file on your computer is much more efficient than it seems. The computer doesn't need to store the x- and y-coordinates - just the pixel values, in one long string.

To reconstruct the image correctly, the computer just needs to "know" the number of columns and rows in the image. This information is often included in the file along with the actual pixel values. It's like the senior class marching into graduation in a single line and filing into separate rows to be seated. As long as you have the right number of chairs in the right number of rows, everything will turn out fine.

This kind of grid of rows and columns is also called a raster, which is why this type of digital image is also called a raster image and why ImageJ is called a raster image processor.

Histograms and Pixel Statistics

Sometimes, it's very useful to look at pixel values statistically. For example, if the pixel values in an image represent temperature, it might be useful to know the average (mean) or the middle (median) or maybe the most common (mode) temperature in the image. ImageJ can sort out the pixel values in an image for you and give you this information in a flash.

  • Choose Analyze > Histogram. A histogram window for the image window will open.
    histogram
  • The histogram shows a frequency distribution of pixel values in the image (or the selected part of an image). In other words, it tells you how many pixels (the Count) there are in the image for each different value from 0 to 255. Think of breaking all the little pixels apart and sorting them into piles with the same value, and arranging the piles in order, from lowest to highest value. Viewed from the side, the "mountain range" of pixel piles would look just like the histogram plot you see here.
  • If you move your cursor across the histogram plot, the value (pixel value) and count (number of pixels in the image with that value) appear in the lower right corner of the histogram window. For example, we can confirm that there are exactly 29 pixels with a value of 238 in this image.
  • If you want to see all of the counts for all of the pixel values, click the List button in the lower left corner of the Histogram window. Cool, huh?
  • Close the Histogram window and window containing the count table.
  • A hot tip: If you select just a part of the image, the histogram will report statistics for only the pixels in the region (the Region Of Interest, or ROI) you selected!

Bit Depth

The previous image was referred to as an 8-bit image. Each pixel is represented in the computer's memory by an 8-bit binary number - representing 256 possible values from 0 to 254. You can think of the bit depth as the 3rd dimension of an image (width and height are the other two).

While 8-bit images are the most common, newer image detectors provide greater information in that third dimension. Higher end consumer digital cameras routinely capture 12 or even 14 bits per pixel before reducing the depth to 8 bits for the final image - corresponding to 4096 and 16,384 possible pixel values. Scientific imaging systems often provide 16-bit resolution - 65,536 possible values. ImageJ can work with images of different bit depths.

  • Right-click (Win) or control-click (Mac) the links below and download the two image files to your Week 2 folder.
  • Open the Lake Mead DEM (8-bit).tif file.
  • This image is a Digital Elevation Model (DEM) of the Lake Mead area. Instead of the brightness, each pixel value in the image represents the elevation at that location. The image has been calibrated so that the pixel values from 0 to 255 are converted to elevation (in meters). Mouse around the image and look at the pixel (elevation) values. Can you find the elevation of the lake itself?
  • Here are some other cool things you can do with DEM images;
    • Apply different lookup tables to the image (Image > Lookup Tables).
    • Threshold the image (highlight a range of pixel values in the image) by choosing Image > Adjust > Threshold. You can make the image look like the land is being flooded by water (or ketchup, since the default threshold color is red).
    • Highlight only the elevation of the lake surface. (To turn off thresholding, click the Reset button in the Threshold window.)
    • Use Analyze > Surface Plot to re-create a 3-D view of the scene.
    • Use one of the line selection tools to select a path through the scene, then create a profile plot along the path (Analyze > Plot Profile).
  • Close the Lake Mead DEM (8-bit).tif image and open the Lake Mead DEM (16-bit).tif image.
  • This is the same image, but in 16-bit format. Since 16 bits can represent values between 0 and 65536, this image can use the actual elevations (in meters) as the pixel values. Watch the value in the status bar as you mouse around the image.
  • ImageJ can do all of the fun tricks (lookup tables, thresholding, surface and profile plotting, measuring, etc.) with 16-bit images that it can do with 8-bit images. (However, you're still limited to lookup tables with just 256 colors, which ImageJ spreads over the range of values in the image.

For more information about bit depth, including sample images, check out this Wikipedia article.

 

Moved from Week 3

  • In ImageJ, load the Stack Tools - a set of buttons that simplify working with stacks. Click the Switch to Alternative Macro Sets button - the red >> button at the right end of the ImageJ tool bar - and choose Stack Tools. Several new buttons will appear on the right side of the tool bar. These buttons provide basic controls for working with stacks. Roll over the tools to display their functions in the ImageJ window's status bar. A complete set of functions for stacks is available under the Image > Stacks submenu or by clicking the Stk (Stacks Menu button on the ImageJ tool bar.

If You Have Time - More to Explore

Spatial Data - Related by Space

MRI Stack with stack counter

Sometimes the slices of a stack are literally slices through a volume of space. An example of this is MRI (magnetic resonance imaging), which uses strong magnetic fields and radio waves to produce images that appear as slices through the body. Different types of tissue have different brightnesses in the image. Using ImageJ, we can stack and animate these slices to visualize tissues and organs in great detail.

  • Choose File > Open Samples > T1 Head (2.4M, 16-bits)
  • Step through the stack using the Next Slice and Previous Slice buttons. This stack is a series of MRI slices through a man's head, beginning from his left shoulder and ending at his right shoulder. The slices are spaced about 5 millimeters apart.
  • Animate the stack at a speed of about 30 fps.
  • Choose Image > Lookup Tables and select one of ImageJ's built-in color tables. Using color lookup tables sometimes makes it easier to see details in the images.

Reconstructed MRI Stack

ImageJ can use the information in these images to create entirely new views, such as 3-D renderings of structures inside the body.

  • Choose File > Open Samples > T1 Head Renderings (736 K)
  • Animate the stack. This view was not produced by the MRI machine, but was created by ImageJ using the MRI slice data.
  • Animate the stack at an appropriate speed, and see what happens when you check the Loop Back and Forth option in the Animation Options dialog box.
  • When you finish examining these stacks, close both stack windows.

Spectral Data - Related by Color or Wavelength

All types of color imaging, from film, to print media, to modern digital cameras reproduce color by gathering brightness data through different colored filters. In most cases, the filters used are Red, Green, and Blue (RGB).

  • Color film has the filters built right into the film, with layers of light-sensitive emulsions recording the scene in Red, Green, and Blue light. The picture is then reproduced on photographic paper or transparency film containing layers of colored dyes. (The dyes used are Cyan, Magenta, and Yellow - the opposites of Red, Green, and Yellow. In combinations, they produce all the colors we see. For example, Cyan and Magenta combine to make Blue.
  • Modern inkjet printers produce colored pictures using microscopic dots of cyan, magenta, and yellow ink, with black ink added to produce deeper blacks and better contrast.
  • If you look at your computer monitor with a magnifying glass, you will see that each pixel on the screen is made up of a set of red, green, and blue bars or dots.
  • The sensors in digital cameras have the red, green, and blue filters coated right on the surface of each light detector cell in an alternating pattern called a Bayer pattern.
  • Scientific satellites often carry multispectral instruments that produce images in different wavelength bands. On LANDSAT satellites, the Multispectral Scanner (MSS) instrument records 4 bands and the Thematic Mapper (TM) records 7 bands, including visible and infrared wavelengths.
  • Newer instruments carried by satellites or aircraft can record images with hundreds of bands. This technology is called hyperspectral imaging. An example is NASA/JPL's AVIRIS instrument (224 channels)

Working with multispectral data in ImageJ

In this section, you will learn how satellites and aircraft use a single black and white camera with many colored filters to capture data that can be used to re-create both natural and false color images.

  • Download and unzip the LANDSAT Image Archive.zip file into the Week 3 directory or folder you created on your computer.
  • Choose File > Import > Image Sequence... to import the seven LANDSAT images, representing the seven Thematic Mapper bands into ImageJ as a stack.
  • Move forward and backward through the stack. The label of each slice lists the TM band it represents. These images show the area around the community of Green River, south of Tucson, Arizona. Do you see signs of mining activity, agriculture, and recreation in the images?
  • After you have explored the images, close the stack.

You are going to use these images to re-create a "true color" version of the scene by combining three bands that represent what is seen in red, green, and blue wavelengths.

  • Open, in order, the Band 3 (red), Band 2 (green), and Band 1 (blue) images and stack them. (Click the Stacks Menu button and choose Images to Stack.)
  • Choose Image > Color > Make Composite.
  • In the Make Composite dialog box, set the Display Mode to Composite and click OK. The resulting image - called a 321 composite, since it assigned bands 3, 2, and 1 to the red, green, and blue channels - is a true color image that approximates what the scene would look like to your "eyes in the sky".
  • Use this technique to produce a false color composite image, assigning different bands to the red, green, and blue color channels. (Hint: 432 images are often used to highlight vegetation in red - try it!)
  • Create your own false color image of this scene and save it to your Week 3 directory. Choose Image > Image Type > RGB Color and save the resulting image as a JPEG file. Use the channel assignments and your initials in your file name.


Moved from Week 2

  • Perhaps refer to this compositor for understanding satellite images (from NASA and Landsat 7.)