Image files (.img) are raster files in the ERDAS IMAGINE format. There are two types of raster layers:
• continuous
• thematic
Thematic raster layers require a different display process than continuous raster layers. This section explains how each raster layer type is displayed.
Continuous Raster Layers
An image file (.img) can contain several continuous raster layers;
therefore, each pixel can have multiple data file values. When
displaying an image file with continuous raster layers, it is possible to assign which layers (bands) are to be displayed with each of the three color guns. The data file values in each layer are input to the assigned color gun. The most useful color assignments are those that allow for an easy interpretation of the displayed image. For example:
• A natural-color image approximates the colors that would appear to a human observer of the scene.
• A infrared image shows the scene as it would appear on color-infrared film, which is familiar to many analysts.
Band assignments are often expressed in R,G,B order. For example, the assignment 4, 2, 1 means that band 4 is assigned to red, band 2 to green, and band 1 to blue. Below are some widely used band to color gun assignments (Faust, 1989):
• Landsat TM—natural color: 3, 2, 1
This is natural color because band 3 is red and is assigned to the red color gun, band 2 is green and is assigned to the green color gun, and band 1 is blue and is assigned to the blue color gun.
• Landsat TM—color-infrared: 4, 3, 2
This is infrared because band 4 = infrared.
• SPOT Multispectral—color-infrared: 3, 2, 1 This is infrared because band 3 = infrared.
Contrast Table
When an image is displayed, ERDAS IMAGINE automatically creates a contrast table for continuous raster layers. The red, green, and blue brightness values for each band are stored in this table.
Since the data file values in continuous raster layers are quantitative and related, the brightness values in the colormap are also quantitative and related. The screen pixels represent the relationships between the values of the file pixels by their colors. For example, a screen pixel that is bright red has a high brightness value in the red color gun, and a high data file value in the layer assigned to red, relative to other data file values in that layer.
The brightness values often differ from the data file values, but they usually remain in the same order of lowest to highest. Some meaningful relationships between the values are usually maintained.
Contrast Stretch
Different displays have different ranges of possible brightness values.
The range of most displays is 0 to 255 for each color gun.
Since the data file values in a continuous raster layer often represent raw data (such as elevation or an amount of reflected light), the range of data file values is often not the same as the range of brightness values of the display. Therefore, a contrast stretch is usually performed, which stretches the range of the values to fit the range of the display.
For example, Figure 39 shows a layer that has data file values from 30 to 40. When these values are used as brightness values, the contrast of the displayed image is poor. A contrast stretch simply stretches the range between the lower and higher data file values, so that the contrast of the displayed image is higher—that is, lower data file values are displayed with the lowest brightness values, and higher data file values are displayed with the highest brightness values.
The colormap stretches the range of colorcell values from 30 to 40, to the range 0 to 255. Because the output values are incremented at regular intervals, this stretch is a linear contrast stretch. (The numbers in Figure 39 are approximations and do not show an exact linear relationship.)
Figure 39: Contrast Stretch and Colorcell Values
See Enhancement for more information about contrast stretching.
Contrast stretching is performed the same way for display purposes as it is for permanent image enhancement.
A contrast stretch based on Percentage LUT with a clip of 2.5%
from left and 1.0% from right end of the histogram is applied to stretch pixel values of all image files from 0 to 255 before they are displayed in the Viewer, unless a saved contrast stretch exists (the file is not changed). This often improves the initial appearance of the data in the Viewer.
Statistics Files
To perform a contrast stretch, certain statistics are necessary, such as the mean and the standard deviation of the data file values in each layer.
Use the Image Information utility to create and view statistics for a raster layer.
input colorcell values
output brightness values
255
0 255 0
30 to 40 range
30→0 31→25 32→51 33→76 34→102 35→127 36→153 37→178 38→204 39→229 40→255
Usually, not all of the data file values are used in the contrast stretch calculations. The minimum and maximum data file values of each band are often too extreme to produce good results. When the minimum and maximum are extreme in relation to the rest of the data, then the majority of data file values are not stretched across a very wide range, and the displayed image has low contrast.
Figure 40: Stretching by Min/Max vs. Standard Deviation
The mean and standard deviation of the data file values for each band are used to locate the majority of the data file values. The number of standard deviations above and below the mean can be entered, which determines the range of data used in the stretch.
See "Math Topics" on page 697 for more information on mean and standard deviation.
Use the Contrast Tools dialog, which is accessible from the Lookup Table Modification dialog, to enter the number of standard
deviations to be used in the contrast stretch.
24-bit DirectColor and TrueColor Displays
Figure 41 illustrates the general process of displaying three continuous raster layers on a 24-bit DirectColor display. The process is similar on a TrueColor display except that the colormap is not used.
0 255
Figure 41: Continuous Raster Layer Display Process
8-bit PseudoColor Display
When displaying continuous raster layers on an 8-bit PseudoColor display, the data file values from the red, green, and blue bands are combined and transformed to a colorcell value in the colormap. This colorcell then provides the red, green, and blue brightness values.
Since there are only 256 colors available, a continuous raster layer looks different when it is displayed in an 8-bit display than a 24-bit display that offers 16 million different colors. However, the Viewer performs dithering with the available colors in the colormap to let a smaller set of colors appear to be a larger set of colors.
See Dithering on page 166 for more information.
Band-to-
brightness values out brightness values out brightness values out
0 255 0 255 0 255
data file values in data file values in
0 255 0 255 0 255
0 255 0 255 0 255
Thematic Raster Layers
A thematic raster layer generally contains pixels that have been classified, or put into distinct categories. Each data file value is a class value, which is simply a number for a particular category. A thematic raster layer is stored in an image (.img) file. Only one data file value—the class value—is stored for each pixel.
Since these class values are not necessarily related, the gradations that are possible in true color mode are not usually useful in pseudo color.
The class system gives the thematic layer a discrete look, in which each class can have its own color.
Color Table
When a thematic raster layer is displayed, ERDAS IMAGINE
automatically creates a color table. The red, green, and blue brightness values for each class are stored in this table.
RGB Colors
Individual color schemes can be created by combining red, green, and blue in different combinations, and assigning colors to the classes of a thematic layer.
Colors can be expressed numerically, as the brightness values for each color gun. Brightness values of a display generally range from 0 to 255, however, ERDAS IMAGINE translates the values from 0 to 1. The maximum brightness value for the display device is scaled to 1. The colors listed in Table 34 are based on the range that is used to assign brightness values in ERDAS IMAGINE.
Table 34 contains only a partial listing of commonly used colors. Over 16 million colors are possible on a 24-bit display.
NOTE: Black is the absence of all color (0,0,0) and white is created from the highest values of all three colors (1, 1, 1). To lighten a color, increase all three brightness values. To darken a color, decrease all three brightness values.
Use the Raster Attribute Editor to create your own color scheme.
24-bit DirectColor and TrueColor Displays
Figure 42 illustrates the general process of displaying thematic raster layers on a 24-bit DirectColor display. The process is similar on a TrueColor display except that the colormap is not used.
Table 34: Commonly Used RGB Colors
Color Red Green Blue
Red 1 0 0
Red-Orange 1 .392 0
Orange .608 .588 0
Yellow 1 1 0
Yellow-Green .490 1 0
Green 0 1 0 Cyan 0 1 1 Blue 0 0 1
Blue-Violet .392 0 .471
Violet .588 0 .588 Black 0 0 0
White 1 1 1
Gray .498 .498 .498
Brown .373 .227 0
Figure 42: Thematic Raster Layer Display Process
Display a thematic raster layer from the Viewer.
8-bit PseudoColor Display
The colormap is a limited resource that is shared among all of the applications that are running concurrently. Because of the limited resources, ERDAS IMAGINE does not typically have access to the entire colormap.
Using the Viewer
The Viewer is a window for displaying raster, vector, and annotation layers. In IMAGINE ribbon Workspace, the Viewer types are:1 2 3
brightness values out brightness values out brightness values out
class values in class values in
• 2D View displays raster, vector, and annotation data in a 2-dimensional view window.
• 3D View renders 3-dimensional DEMs, raster overlays, vector layers, and annotation feature layers.
• Map View is designed to create maps and presentation graphics.
You can open as many Viewer windows as their window manager supports.
NOTE: The more Viewers that are opened simultaneously, the more RAM memory is necessary.
The Viewer not only makes digital images visible quickly, but it can also be used as a tool for image processing and raster GIS modeling. The uses of the Viewer are listed briefly in this section, and described in greater detail in other chapters of the ERDAS Field Guide.
Colormap
ERDAS IMAGINE does not use the entire colormap because there are other applications that also need to use it, including the window manager, terminal windows, Arc View, or a clock. Therefore, there are some limitations to the number of colors that the Viewer can display simultaneously, and flickering may occur as well.
Color Flickering
If an application requests a new color that does not exist in the
colormap, the server assigns that color to an empty colorcell. However, if there are not any available colorcells and the application requires a private colorcell, then a private colormap is created for the application window. Since this is a private colormap, when the cursor is moved out of the window, the server uses the main colormap and the brightness values assigned to the colorcells. Therefore, the colors in the private colormap are not applied and the screen flickers. Once the cursor is moved into the application window, the correct colors are applied for that window.
Resampling
When a raster layer(s) is displayed, the file pixels may be resampled for display on the screen. Resampling is used to calculate pixel values when one raster grid must be fitted to another. In this case, the raster grid defined by the file must be fit to the grid of screen pixels in the Viewer.
All Viewer operations are file-based. So, any time an image is
resampled in the Viewer, the Viewer uses the file as its source. If the raster layer is magnified or reduced, the Viewer refits the file grid to the new screen grid.
The resampling methods available are:
• Nearest Neighbor—uses the value of the closest pixel to assign to the output pixel value.
• Bilinear Interpolation—uses the data file values of four pixels in a 2
× 2 window to calculate an output value with a bilinear function.
• Cubic Convolution—uses the data file values of 16 pixels in a 4 × 4 window to calculate an output value with a cubic function.
These are discussed in detail in "Rectification" on page 251.
The default resampling method is Nearest Neighbor.
Preference Editor
The Preference Editor enables you to set parameters for the Viewer that affect the way the Viewer operates.
See the ERDAS IMAGINE On-Line Help for the Preference Editor for information on how to set preferences for the Viewer.
Pyramid Layers
Sometimes a large image file may take a long time to display in the Viewer or to be resampled by an application. The Compute Pyramid Layer option enables you to display large images faster and allows certain applications to rapidly access the resampled data. Pyramid layers are image layers which are copies of the original layer successively reduced by the power of 2 and then resampled.Both IMAGINE native pyramid layers and LPS/Stereo Analyst pyramid layers are generated with a reduction factor of 2; however, each uses different filters and different layer options.
The Compute Pyramid Layers option in IMAGINE has three options for continuous image data (raster images); 2x2, 3x3, or 4x4 kernel size filtering methods. The 3x3 kernel size is recommended for LPS and Stereo Analyst photogrammetry functions.
LPS/Stereo Analyst pyramid layers and the 3x3 kernel are discussed in Image Pyramid on page 631.
A 2 x 2 kernel calculates the average of 4 pixels in a 2x2 pixel window of the higher resolution level and applies the average to one pixel for the current level of pyramid. The filter can be represented as:
The computation is simple, resulting in fast pyramid layer processing time. This kernel is suitable for image visual observation, however it can result in a high degree of smoothing or sharpening which is not necessarily desirable for digital photogrammetric processing.
A 4 x 4 kernel uses 16 neighboring pixels of the higher resolution level to arrive at one pixel for the current pyramid level. The processing time for this method is much longer than the others, since the computation requires a greater number of pixel operations and is based on double precision arithmetic. This method is not recommended for multi-resolution image matching. (Wang, Y. and Yang, X. 1997)
If the raster layer is thematic, then it is resampled using the Nearest Neighbor method.
See "Rectification" on page 251 for more information on Nearest Neighbor.
The number of pyramid layers created depends on the size of the original image. A larger image produces more pyramid layers. When the Compute Pyramid Layer option is selected, ERDAS IMAGINE automatically creates successively reduced layers until the final pyramid layer is as small as a block size of 64 x 64 pixels. The default block size is 512 × 512 pixels.
See Block Size in ERDAS IMAGINE .img Files On-Line Help for information on block size.
Pyramid layers are added as additional layers in the image file.
However, these layers cannot be accessed for display. The file size is increased by approximately one-third when pyramid layers are created.
The actual increase in file size can be determined by multiplying the layer size by this formula
Where:
n = number of pyramid layers
NOTE: This equation is applicable to all types of pyramid layers:
internal and external.
1 4 --- 1 1
1 1
Pyramid layers do not appear as layers which can be processed: they are for viewing purposes only. Therefore, they do not appear as layers in other parts of the ERDAS IMAGINE software (for example, the Arrange Layers dialog).
The Image Files (General) section of the Preference Editor contains a preference for the Initial Pyramid Layer Number. By default, the value is set to 1. This means that all reduced pyramid layers generated are retained.
Pyramid layers can be deleted through the Image Metadata dialog.
However, when pyramid layers are deleted, they are not deleted from the image file; therefore, the image file size does not change, but ERDAS IMAGINE utilizes this file space, if necessary. Pyramid layers are deleted from viewing and resampling access only - that is, they can no longer be viewed or used in an application.
1 4
i----i=0 n
∑
Figure 43: Pyramid Layers
For example, a file that is 4K × 4K pixels could take a long time to display when the image is fit to the Viewer. The Compute Pyramid Layers option creates additional layers successively reduced from 4K × 4K, to 2K × 2K, 1K × 1K, 512 × 512, 128 × 128, down to 64 × 64. ERDAS IMAGINE then selects the pyramid layer size most appropriate for display in the Viewer window when the image is displayed.
The Compute Pyramid Layers option is available from the ImageInfo dialog and the Image Command Tool.
For more information about the .img format, see "Raster Data" on page 1 and ERDAS IMAGINE .img Files On-Line Help.
External Pyramid Layers
Pyramid layers can be either internal or external. If you choose external pyramid layers, they are stored with the same name in the same directory as the image with which they are associated, but with the .rrd extension. For example, an image named tm_image1.img has external pyramid layers contained in a file named tm_image1.rrd.
Original Image
Pyramid layer (2K × 2K) Pyramid layer (1K × 1K) Pyramid layer (512 × 512) Pyramid layer (128 × 128) Pyramid layer (64 × 64)
image file
ERDAS IMAGINE selects the pyramid layer that displays the fastest in the Viewer.
(4K × 4K)
The extension .rrd stands for reduced resolution data set. You can delete the external pyramid layers associated with an image by accessing the Image Information dialog. Unlike internal pyramid layers, external pyramid layers do not affect the size of the associated image.
Some raster formats create internal pyramid layers by default and may not allow applications to control pyramid layers. This case will ignore your Pyramid Layer Preference settings.
Dithering
A display is capable of viewing only a limited number of colorssimultaneously. For example, an 8-bit display has a colormap with 256 colorcells, therefore, a maximum of 256 colors can be displayed at the same time. If some colors are being used for auto update color
adjustment while other colors are being used for other imagery, the color quality degrades.
Dithering lets a smaller set of colors appear to be a larger set of colors.
If the desired display color is not available, a dithering algorithm mixes available colors to provide something that looks like the desired color.
For a simple example, assume the system can display only two colors:
black and white, and you want to display gray. This can be accomplished by alternating the display of black and white pixels.
Figure 44: Example of Dithering
In Figure 44, dithering is used between a black pixel and a white pixel to obtain a gray pixel.
The colors that the Viewer dithers between are similar to each other, and are dithered on the pixel level. Using similar colors and dithering on the pixel level makes the image appear smooth.
Dithering allows multiple images to be displayed in different Viewers without refreshing the currently displayed image(s) each time a new image is displayed.
Black Gray White
Color Patches
When the Viewer performs dithering, it uses patches of 2 × 2 pixels. If the desired color has an exact match, then all of the values in the patch match it. If the desired color is halfway between two of the usable
When the Viewer performs dithering, it uses patches of 2 × 2 pixels. If the desired color has an exact match, then all of the values in the patch match it. If the desired color is halfway between two of the usable