Constructing Custom Colormaps for Data Explorer
Ray Masters
Graduate Education and Research Support
Center for Academic Computing
Associate Professor of Architecture
The Pennsylvania State University
Tip
Are the colors displayed by Data Explorer just a little different than
you specified? If so, look into DXGAMMA environmental variable (also,
DXHWGAMMA, DXGAMMA_8BIT, DXGAMMA_12BIT, DXGAMMA_24BIT, etc., as
appropriate). These set the gamma correction for software- and
hardware-rendered images displayed to the screen by a Display or Image
tool. On many display devices a given change in the digital brightness
of the image is not reflected in a corresponding change in screen
brightness. A gamma correction is a nonlinear adjustment of the pixel
values to compensate for this difference and produce a more accurate
representation on the screen. By default (except for 8-bit windows
on the SGI architecture), the correction factor (exponent) is 2 (two),
on the assumption that the display is NOT otherwise gamma corrected.
The DXGAMMA variable allows one to override this default. If the display
device is already gamma corrected, set the variable to 1. See "Display"
in the IBM Visualization Data Explorer User's Reference, and README_sgi
in /usr/lpp/dx for additional information.
For C-shell users, the following line should be put into their .cshrc file:
setenv DXGAMMA 1.0
Another Tip
Are your stored images (from WriteImage) appearing different from the
same images on your display? If so, these require an additional GAMMA
specification--the one for your display is NOT automatically associated
with the creation of a stored image. Simply append gamma=1.0
(or whatever value is appropriate) to the format specification
in the WriteImage module.
Want additional
information on gamma and color?
Now, onto the colormap stuff...
The Data Explorer colormap is a one-dimensional field object. It has
regular connections (lines between data points) and irregular positions
(the break points can occur anywhere). The "location" of these points
is the value of the data being colored. The "data" of the colormap are
(r,g,b) values (in the range 0.0 to 1.0) that will be assigned to the
"color" component of the objecting being colored. Coloring data is a simple
process of locating the data value being colored on the continuium between
minimum and maximum, and then interpolating the appropriate (r,g,b) value
from the specified points that are immediately lower and higher than the
value. Data values less than the minimum or greater than the maximum will
not be colored. See the description of the "Color" module for a detailed
explanation.
Here's an example of constructing and using a colormap in data
explorer. In this example, we create an arbitrary data surface with data
values ranging from 0.0 to 100.0. Using interactors, we specify a value
in that range to "break" the color, e.g.--values less than that are colored
the "low" color, values greater than that are colored the "high" color. The
color specifications for "low" and "high" are also done through interactors.
The data explorer files for this application are here:
colormap.net and
colormap.cfg.
You can link to them and then save the source, or simple press the
"Shift" key while clicking the hotlink to automatically download and save.
The application is organized into three dx "pages"--one page,
"Colors",
provides the color interactors and constructs the "data" component of the
colormap. Another page,
"Make_CM",
provides another interactor to set the
data "break point" and then creates a valid colormap with all that
information. The third page,
"Make_Object", constructs a surface and
applies the custom colormap to it. The pages are fully commented
so they should be fairly easy to understand.
Please send questions or suggestions about this web page to:
sp@rcc.its.psu.edu
ASET | ITS | Penn State
|