
Viewimage(View Utils)        Khoros         Viewimage(View Utils)

     Colormaps

     The Colormap subform contains standard colormaps through
     which the image pixel values can be mapped. Color can be
     changed using the following color schemes:

     1)   RGB Cube

     2)   RGB Triangle

     3)   RGB Spiral

     4)   HLS Spiral

     5)   HSV Rings

     6)   HLS Rings

     7)   RGB Distance

     8)   CIE Diagram

     9)   Density Slice

     10)  Greyscale

     11)  Original

     12)  Rainbow

     13)  Invert

     14)  Invert Original

     15)  Random

     16)  SA Pseudo

     BACKGROUND:

     Colormaps:

     When imagery data is displayed, a colormap, or look up table
     (LUT), is used which maps actual image pixel values to some-
     thing 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.

     Positional vs. Data Dependent Mapping:

     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 posi-
     tional colormaps.

     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.

     RGB Colorspace:

     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.

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

     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

     Colormap Descriptions:

     In all of the colormap routines described below, the algo-
     rithm first finds the minimum and maximum values in the ori-
     ginal 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.

     1.  RGB Cube:
         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 continuous manner. The order in which the sides of
         the cube are traced is:
         blue -> magenta -> red -> yellow -> green -> cyan ->
         blue.

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

         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).

         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

     2.  RGB Triangle:
         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 disjoint 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.

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

         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).

         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

     3.  RGB Spiral:
         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.

     5.  HSV Rings:
         The documentation of HSV Rings has not been written as
         of BETA.  sorry, folks.

     6.  HLS Rings:
         See HSV Rings

     7.  RGB Distance:
         RGB Distance is a data dependent colormap operation
         which assigns the red and green components of the color-
         map according to characteristics of the imagery's histo-
         gram, and the blue component according to pixel intensi-
         ties.  The red primary components are determined by cal-
         culating 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.

         a.  Calculate mean pixel value of the histogram.

         b.  Calculate calculate the average variance of the his-
             togram.

         c.  Assigning the Red colormap:
             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 mul-
             tiplied by a variance scaling factor.

         d.  Assigning the Green Colormap:
             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 max-
             imum 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 multi-
             plied by a mean scaling factor.

         e.  Assigning the Blue Colormap:
             The blue colormap is assigned directly from the
             intensity values of the imagery.  The lowest inten-
             sity value is mapped to 0 and the highest intensity
             value is assigned 255.  All other intensities are
             given blue values between 0 and 255.

     8.  CIE Diagram:
         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.

         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).

         RANGE        RED          GREEN         BLUE
           1       max -> min       min        min -> max
           2          min        min -> max    max -> min
           3       min -> max    max -> min       min

     9.  Density Slice:
         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 tri-
         angle).  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.)
         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 his-
         togram 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 exam-
         ple, pixels 3 and 8 will be red, pixels 0, 4, 5, and 7
         will be green, and pixels 1 and 6 will be blue.

                      Density Slicing

                _|_ _ _ _ _ _ _ _ _ _ _
          num.   |       |                bin3
                _|_ _ _ _|_ _ _ _ _|_ _
          of     |       |   |     |      bin2
                _|_|_ _ _|_|_|_ _|_|_ _
          pix.   | | |   | | | | | |      bin1
                 | | |   | | | | | |
                -|---------------------
                   0 1 2 3 4 5 6 7 8 9
                       pixel value

     10.  Greyscale:
         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).

     11.  Original Colormap:
         This assigns to the imagery the original colormap that
         it had when it was read into viewimage.

     12.  Rainbow:
         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.

     13. Invert:
         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).

     14. Invert Original:
         This assigns to the imagery a colormap that is the ori-
         ginal colormap with inverted values.

     15. Random:
         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.

     16. SA Pseudo:
         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.

         Copyright 1991, University of New Mexico. All rights
         reserved.

Version: 0                 Release: 1                           1

