.LP
The Colormap subform contains standard colormaps through which
the image pixel values can be mapped.  
Color can be changed using the following color schemes:
.IP 1) 
RGB Cube
.IP 2)
RGB Triangle
.IP 3)
RGB Spiral 
.IP 4)
HLS Spiral
.IP 5)
HSV Rings
.IP 6)
HLS Rings
.IP 7)
RGB Distance
.IP 8)
CIE Diagram
.IP 9)
Density Slice
.IP 10)
Greyscale
.IP 11)
Original 
.IP 12)
Rainbow
.IP 13)
Invert
.IP 14)
Invert Original
.IP 15)
Random
.IP 16)
SA Pseudo
.sp
.SH
BACKGROUND:
.SH
Colormaps:
.PP
When imagery data is displayed, a colormap, or look up table (LUT), is used 
which maps actual image pixel values to something that is meaningful to the 
display hardware.  Color displays require that values for all three primary 
colors be specified.  Therefore the colormap maps the single image pixel value
to a set of three values, one for red, one for green, and one for blue.
.SH
Positional vs. Data Dependent Mapping:
.PP
Two types of mapping schemes are available.  The first is positional mapping,
meaning that colors are mapped with respect to the position 
that the pixel values occupy in the original colormap.
Positional mappings have no dependency on the properties of the actual imagery 
data, only on the physical layout of the imagery's colormap.
RGB cube, RGB triangle, RGB spiral, CIE diagram, and Grayscale 
are positional colormaps.
.PP
Data dependent mapping, on the other hand, maps according to properties of the
imagery data.  For example, the density slice operation maps color according
to the histogram of the imagery pixel values.
RGB distance and Density Slice are data dependent colormaps.
.SH
RGB Colorspace:
.PP
The color model that is being used is the RGB cube. The RGB cube can be 
visualized as a three dimensional orthogonal system in which the primary 
colors ,red, green, and blue, constitute the axes.  
.DS
.nf
\f(CW

                    Red              Magenta
                    -----------------
                   /|               /|
                  / |              / |
                 /  |             /  |
                /   |            /   |
         Yellow ---------------- W   |
                |   |            |   |
                |   B------------|---- Blue 
                |  /             |  /               
                | /              | /
                |/               |/        
         Green  ------------------  Cyan

\fP
.fi
.DE
.sp
The values along each primary axis range from 0 to 255, and when all 
three values are 0, the color black (B) results. 
Similarly, white (W) is created by setting the three primary values to 255.
The points labeled Red, Green, and Blue represent the maximum value of each
primary when the values of the other two primaries are set to zero.  
The points labeled
Cyan, Magenta, and Yellow represent the secondary colors.  Cyan is 
the combination of blue and green with red set to zero, 
magenta is the combination of red and blue with green set to zero, and 
yellow is the combination of red and green with blue set to zero.
Anytime all three primaries have the same value, the color is a gray, and
it lies along the diagonal running from black to white 
.sp
.SH
Colormap Descriptions:
.PP
In all of the colormap routines described below, the algorithm first 
finds the minimum and
maximum values in the original colormap and then "stretches" them such that
the resulting colormap utilizes the minimum and maximum ranges of each primary.
This is done because it allows for better visual discrimination between 
colors in the enhanced imagery.
.sp
.IP "1.  RGB Cube: " 4
.br
The RGB Cube colormap is a positional colormap which maps the original values
to a set of colors that are determined by following the edges of 
the RGB color cube in a
\fIcontinuous\fP manner. The order in which the sides of the cube are traced is:
.br
blue -> magenta -> red -> yellow -> green -> cyan -> blue.
.br
.DS
.nf
\f(CW

                           2
                 Red   <-------   Magenta
                 -----------------
            /   /|               /|  ^
         3 /   / |              / |  |
          v   /  |             /  |  | 1
             /   |            /   |  |
      Yellow ---------------- W   |
             |   |            |   |
         |   |   B------------|---- Blue 
       4 |   |  /             |  /   ^
         v   | /              | /   / 6
             |/               |/   /
      Green  ------------------  Cyan
                ---------->
                     5

\fP
.fi
.DE
The minimum and maximum values in the original colormap are found along with
the number of colors, N.  N is then is divided by six which is
the number of sides of the RGB cube that are traced.  
This sets up six ranges with N/6 steps in each range.
When the number of colors in the original colormap is not a factor 
of six, the difference is made up in the sixth range.  Colors
are assigned to these ranges according to the following rules, where min is the
minimum primary value (usually 0), max is the maximum value (usually 255), and
min -> max means that the values of that primary are ranged between the 
minimum and maximum values, or vise versa (max -> min).
The minimum and maximum values in the original map are
assigned the color blue (0,0,255).
.sp
.DS
.nf
\f(CW
RANGE        RED          GREEN         BLUE
  1       min -> max       min           max
  2          max           min        max -> min
  3          max        min -> max       min
  4       max -> min       max           min
  5          min           max        min -> max
  6          min        max -> min       max 
\fP
.fi
.DE
.sp 2
.IP "2.  RGB Triangle:" 4
.br
The RGB Triangle colormap is a positional colormap which maps 
the original values
to a set of colors that are determined by following the edges of 
the RGB color cube in a
\fIdisjoint\fP manner. The order in which the sides of the cube are traced is:
red -> magenta, red -> yellow, 
green -> yellow, green -> cyan, 
blue -> magenta, blue -> cyan.
.sp
.DS
.nf
\f(CW
                           1
                 Red   ------->   Magenta
                 -----------------
            /   /|               /|  ^
         2 /   / |              / |  |
          v   /  |             /  |  | 5
             /   |            /   |  |
      Yellow ---------------- W   |
             |   |            |   |
         ^   |   B------------|---- Blue 
       3 |   |  /             |  /   /
         |   | /              | /   / 6
             |/               |/   v
      Green  ------------------  Cyan
                ---------->
                     4
\fP
.fi
.DE
.sp
The minimum and maximum values in the original colormap are found along with
the number of colors, N.  N is then is divided by six which is
the number of sides of the RGB cube that are traced.  
This sets up six ranges with N/6 steps in each range.
When the number of colors in the original colormap is not a factor 
of six, the difference is made up in the sixth range.  Colors
are assigned to these ranges according to the following rules, where min is the
minimum primary value (usually 0), max is the maximum value (usually 255), and
min -> max means that the values of that primary are ranged between the 
minimum and maximum values, or vise versa (max -> min).
The minimum value in the original map is assigned the color red (255,0,0),
and the maximum value is assigned the color blue (0,0,255).
.sp
.DS
.nf
\f(CW
RANGE        RED          GREEN         BLUE
  1          max           min        min -> max
  2          max        min -> max       min
  3       min -> max       max           min
  4          min           max        min -> max
  5       min -> max       min           max
  6          min        min -> max       max 
\fP
.fi
.DE
.sp 2
.IP "3.  RGB Spiral: " 4
.br
RGB spiral is a quadratic mapping that maps colors as a spiral which encircles
the grey line from black to white.
This mapping is a positional mapping.
.sp
.IP "5.  HSV Rings:" 4
.br
The documentation of HSV Rings has not been written as of BETA.  sorry, folks.
.sp 2
.IP "6.  HLS Rings:" 4
.br
See HSV Rings
.sp 2
.IP "7.  RGB Distance:" 4
.br
RGB Distance is a data dependent colormap operation which assigns 
the red and green components of the colormap according to characteristics of 
the imagery's histogram, and the blue component according to pixel intensities.
The red primary components are determined by calculating a delta variance for
each cell of the original colormap, and the green
components according to a delta mean calculation for each cell.
The method of assigning colors is reviewed below.
.RS
.IP a. 4
Calculate mean pixel value of the histogram.
.IP b. 4
Calculate calculate the average variance of the histogram.
.IP c. 4
Assigning the Red colormap:
.br
Calculate a delta variance value for each cell in the original colormap.  
This is done by subtracting the average variance of the imagery's histogram from
the number of pixels in the imagery which have that cell's color
This will give a delta variance value for each cell in the original colormap.  
The minimum and maximum delta variance values are found and the minimum 
is mapped to zero of the red primary and the maximum value is mapped to 
255 of the red primary.  All other cells are assigned
red values between 0 and 255 according to their delta variance value multiplied
by a variance scaling factor.
.IP d. 4
Assigning the Green Colormap:
.br
Calculate a delta mean value for each cell in the original colormap.  
This is done by subtracting the mean pixel value of the imagery's histogram from
the number of pixels in the imagery which have that cell's color
This will give a delta mean value for each cell in the original colormap.  
The minimum and maximum delta mean values are found and the minimum 
is mapped to zero of the green primary and the maximum value is mapped to 
255 of the green primary.  All other cells are assigned
green values between 0 and 255 according to their delta mean value multiplied
by a mean scaling factor.
.IP e. 4
Assigning the Blue Colormap:  
.br
The blue colormap is assigned directly from the
intensity values of the imagery.  The lowest intensity value is mapped to 0
and the highest intensity value is assigned 255.
All other intensities are given blue values between 0 and 255.
.RE
.sp 2
.IP "8.  CIE Diagram:" 4
.br
The CIE Diagram colormap is a positional colormapping scheme which maps
the original values to a set of colors 
that are determined by following the edges of a triangle in the RGB
color cube in a continuous path.  
The vertices of this triangle are the red, green, and blue 
primaries, and the order in which the sides are traced is from
red, to blue, to green, to red. 
.sp
The minimum and maximum values in the original colormap are found along with
the number of colors, N.  N is then is divided by three which is
the number of sides in the triangle that will be traced.  
This sets up three ranges with N/3 steps in each range.
If the number of colors in the original colormap is not a factor 
of three, the difference is made up in the third range.  Colors
are assigned to these ranges according to the following rules, where min is the
minimum primary value (usually 0), max is the maximum value (usually 255), and
min -> max means that the values of that primary are ranged between the 
minimum and maximum values, or vice versa (max -> min).
The minimum and maximum values in the original map are assigned 
the color red (255,0,0).
.sp
.DS
.nf
\f(CW
RANGE        RED          GREEN         BLUE
  1       max -> min       min        min -> max
  2          min        min -> max    max -> min
  3       min -> max    max -> min       min
\fP
.fi
.DE
.sp 2
.IP "9.  Density Slice:" 4
.br
Density Slice is a data dependent colormapping algorithm which assigns colors
according to the distribution of the imagery's histogram.  When the 
histogram of the imagery is computed, the maximum number of pixels per cell
is found.  This is used to determine the bin size for the density slicing
operation.  Once the bin sizes have been determined, the histogram is searched
for cells which fall into each bin, and these pixel 
values are mapped to colors which vary from green to blue to red
(follows the first two legs of the CIE diagram triangle).
Blue represents the cell with the fewest number of pixels in the imagery, 
and red represents the cell with the highest number of pixels.
(A colormapping which covers the spectrum from violet to red will be implemented
in the future.)
.br
A simple example of density slicing is given below.
In the example histogram, there are 10 possible pixel values, or cells. The
density slice will divide the histogram into 3 slices.  Cells which
occupy enough pixels in the imagery to fall into bin 3 will be assigned red, 
those that fall into bin 2 will be green and those that fall into bin 1 
will be blue.
Therefore, in this example, pixels 3 and 8 will be red, pixels 0, 4,
5, and 7 will be green, and pixels 1 and 6 will be blue.
.sp
.DS
.nf
\f(CW
             Density Slicing
 
       _|_ _ _ _ _ _ _ _ _ _ _
 num.   |       |                bin3
       _|_ _ _ _|_ _ _ _ _|_ _
 of     |       |   |     |      bin2
       _|_|_ _ _|_|_|_ _|_|_ _ 
 pix.   | | |   | | | | | |      bin1
        | | |   | | | | | |  
       -|---------------------
          0 1 2 3 4 5 6 7 8 9
              pixel value  

\fP
.fi
.DE
.sp 3
.IP "10.  Greyscale:" 4
.br
The greyscale colormap is position dependent and maps colors
in the original colormap to the greys. Since greys are formed by
setting red, green, and blue to the same value, the mapping occurs in the 
RGB cube along the diagonal connecting black (0,0,0) and white (255,255,255).
.sp
.IP "11.  Original Colormap:" 4
.br
This assigns to the imagery the original
colormap that it had when it was read into \fBviewimage\fP.
.sp 
.IP "12.  Rainbow:" 4
.br
The rainbow colormap is position dependent and maps colors in the original
colormap to a rainbow by coloring the imagery in HSV space and then converting
the values back into RGB space.  This is done by setting the value and 
saturation to 1.0, and varying the hue between 0.0 and 1.0.
.sp 
.IP "13. Invert:" 4
.br
Selecting this button will invert whichever colormap is currently
being displayed.  This is done by subtracting each red, green, blue value 
from 255. (red, green, blue) -> (255-red, 255-green, 255-blue).
.sp 
.IP "14. Invert Original:" 4
.br
This assigns to the imagery a colormap that is the original
colormap with inverted values.
.sp 
.IP "15. Random:" 4
.br
This assigns to an image a colormap with totally random values.  The routine
assigns random values (0 - 255) to each red, green, blue primary.  The Un*x
random function is used with the current time used as the seed.
.sp
.IP "16. SA Pseudo:" 4
.br
This colormap is based on an article found in Scientific American.  The colormap
is designed to convert a grey scale image and convert it to a color image of
the same intensity.  The algorithm takes each entry and maps it to a 
corresponding red, green, blue value that has been chosen more for it's
aesthetics than it's quantative value.  The article was discovered by
Joe Fogler who typed in the value tables and added a few corrections to make
the colormap even more aesthetically pleasing.
.sp
