Next: , Previous: , Up: Graphics   [Contents][Index]


8.3 Image Display

The standard image display routine is tv. It displays the contents of a two-dimensional numerical array at a user-specified location in a user-specified window, after optional magnification and scaled for maximum contrast. Images are displayed with dimension 0 of the data increasing to the right, and dimension 1 increasing upward. Array element (0,0) is displayed in the lower left-hand corner of the image.

By default, the position specified for an image is the location of the lower left-hand corner of the image in dev coordinates (See Screen Coordinates). In older versions of LUX, the upper left-hand corner was used for this in the native X window coordinate system. For backward compatibility, this feature is still available if you execute SET,/ULIMCOORDS beforehand.

In the X window display system used by LUX, a finite number of different colors can be displayed at any one time. Depending on your computer system and the default settings for your window manager, you may be using any one of the six display methods ("visual classes") offered by X. Most users probably have an 8-bit PseudoColor display by default, which can show 256 distinct colors at any given time, and the characteristics of this display method are explained below.

The colors available for display at a given time can be thought of as occupying a finite number of color cells with one color to a cell, forming a color map. The finite number (usually 256) of color cells available in the default color map must be shared between all X window applications (such as LUX) running at the time. If LUX finds that not enough color cells remain in the default color map, then it requests its own private color map (Colors).

When you display an image in a LUX window using the tv routine, then three transformations are performed to translate an image value into a color: First the data value is scaled linearly to a byte index into the available color range, using the scale function. The lowest image value is scaled to !scalemin and the highest one to !scalemax. These two variables are set to 0 and 255, respectively, when color cells are first allocated, but they may be changed by the user.

Next, the color range values are translated into indices into the color map. LUX has no control over exactly which color map elements are allocated to it, and in what order, so the color map indices of the color cells allocated to LUX need not form a contiguous or ordered set, and need not be the same from LUX session to LUX session even if the same number of color cells are allocated by LUX in those different sessions. Color cell indices between 0 (inclusive) and the number of color cells (exclusive) that was allocated by LUX are guaranteed to correspond to colors allocated by LUX, but there is no such guarantee for any particular color map index.

Finally, the color map indices are translated into particular colors through the color table. By default, LUX’s color table ranges regularly from black (color cell index 0) to white (highest color cell index). You can specify an alternative color map with the tvlct routine.

If you wish to suppress the first or first two of these transformations, then use the tvmap or tvraw routines instead of tv. tvmap assumes that the byte image contains LUX color cell indices, and tvraw assumes the byte image contains color map indices.

See also: !scalemax, !scalemin, set, tv, tvlct, tvmap, tvraw, xopen


Next: , Previous: , Up: Graphics   [Contents][Index]