next up previous

To obtain a better display of the data set, a new palette has to be selected. The application X Image functions in what is called an 8 bit color environment. This means that, for each pixel the available colors are selected from a palette, or color look up table (CLUT) whose entries are addressable by 8 bits, or 1 byte. Thus, in an 8 bit color environment, once a palette has been selected, each pixel can be assigned any one of the 256 = 28 colors from that palette. Several color models are used to define palettes, but probably the most popular is the RGB, or Red-Blue-Green model. Using the RGB color model, each of the 256 entries in a palette is a color having a Red, a Blue and a Green component. In turn, each of these R, G and B components is set with a byte value and can take on one of the 256 values ranging from 0 to 255. A palette consistent with the HDF library palette conventions consists of a byte stream of 768 = 3*256 bytes in which the values of the first 256 bytes fix the Red components of the 256 colors in the palette; the next 256 bytes fix the Green components of the 256 colors in the palette; and the final 256 bytes fix the Blue components of the colors in the palette.

A new palette (CLUT) for interrogating a data set can be obtained by (1) loading an existing palette; (2) using a graphical palette creation/editing tool; or (3) by means of a FORTRAN or C program. Clicking on the Change Palette option of Figure 4 provides a dialog box from which you can load a previously stored palette. If stored palettes have been made available to you, experiment with loading some of these to produce alternate images of the data set. If no previously stored palettes are available, then use Code 2 to construct a palette, called new.pal. Then click on the Change Palette option in Figure 4 and follow the instructions for loading new.pal.

To become familiar with the graphical palette creation/editing tool in X Image, return to the main X Image panel ( Figure1) and left click on Palette to activate the palette editing tool displayed in Figure 5.

Figure 5 Palette Manipulation Tool

The palette tool allows control of the colors that NCSA X Image assigns to the numbers in your data set. Three color models are available: the widely used Red-Green-Blue (RGB); the Cyan-Magenta-Yellow model; and the Hue-Saturation-Value (HSV) model. You should experiment with each of these to see which method of creating palettes best suits your eye. For example, consider the RGB color model. A left click in one of the square boxes to the left of Red, Green or Blue toggles on/off a display of the amount of that color that is present in each of the 256 colors represented by the color bar at the top of the window. Clicking the left button on the diamond next to a color and driving into the window just below the color bar produces a pencil that can be used to draw a curve that specifies the amount of that color to be present in the palette being created or edited. As this is done with each of the three colors the palette under design evolves. The Reset button and the Undo button are useful in recovering from drawing mistakes. The Smooth button removes sharp transitions introduced by freehand drawing of a color component curve. Try repeatedly clicking the Smooth button and watch the RGB curves in the window below the color bar. The Load button allows for the import of existing palettes for editing or for display of their RGB components. (Note that the loading window for a new palette is the same as the loading window for a data set.) The Save button in connection with the File Name window to its right can be used to name and store a palette that you have created. Use care in clicking on the option labeled "Don't use entire palette". Under some circumstances invoking this option can put your screen in a state where it is difficult (or next to impossible) to see the mouse pointer.