PCTMAKE -- Make a Pseudocolour Table

Generates a pseudocolour table (PCT) from a theme channel, and an RGB (colour) image, so that the theme channel is coloured to `match' the RGB image.

This capability is especially useful in creating PCTs for the theme channel output from one of the clustering programs (KCLUS, ISOCLUS, or NGCLUS). In unsupervised classification, the PCT can be passed to the aggregation (labelling) program AGGREG, allowing the user to more readily identify or locate areas. The PCT and theme channel can also represent an 8-bit compression of 24-bit RGB imagery.

See Also: KCLUS, ISOCLUS, NGCLUS, NGCLUS2, MLC, AGGREG, CMPRSS8

PARAMETERS

PCTMAKE is controlled by the following global parameters:

Name     Prompt                                  Count     Type
FILE     Database File Name                      1-64      Char
DBIC     Database Input Channel List             3         Int
DBLUT    Database Lookup Table Segment           0-3       Int
DBTC     Database Theme Channel                  1         Int
DBPCT    Database Pseudocolour Segment           0-1       Int
MASK     Area Mask (Window or Bitmap)            0-4       Int
DBSN     Database Segment name                   0-8       Char
DBSD     Database Segment Descriptor             0-64      Char

The following parameter receives output:

DBPCT    Database Pseudocolour Segment           0-1       Int

FILE

Specifies the name of the PCIDSK image file containing the imagery and theme channels.

 EASI>FILE="filespec"

DBIC

Specifies the three 8-bit channels containing the RGB image.

 EASI>DBIC=r,g,b
If r, g, and b are all the same channel number then this is equivalent to specifying a black and white image. Ranges of channels can be specified with negative values. For example: {2,-4} is internally expanded to {2,3,4}.

DBLUT

Optionally specifies LUTs that can be used to enhance the RGB channels specified in DBIC. Original data in DBIC is not overwritten.

 EASI>DBLUT=i,j,k                 | use LUTs to enhance
 EASI>DBLUT=                      | no enhancement, use raw RGB
Ranges of segments can be specified with negative values. For example: {2,-4} is internally expanded to {2,3,4}.

DBTC

Specifies the 8-bit channel containing the theme data, usually the output from one of the unsupervised classifiers.

 EASI>DBCT=i

DBPCT

Optionally specifies the database pseudocolour table (PCT) segment to receive data. If no segment number is specified, then a new segment is created.

 EASI>DBPCT=n                     | overwrite PCT segment n
 EASI>DBPCT=                      | create a new segment
If a new segment is created, then DBPCT is updated with the new segment number when the program completes.

MASK

Specifies the areas (regions of interest) in the input imagery that should be processed when generating the pseudocolour table.

 EASI>MASK=xoff,yoff,xsize,ysize  | process window
 EASI>MASK= b                     | process only under bitmap
                                  | stored in segment b
 EASI>MASK=                       | process entire image

DBSN

Specifies a 1 to 8 character quick identifier for the pseudocolour table.

 EASI>DBSN="string"
This value is only used if a new pseudocolour segment is created.

DBSD

Specifies a 1 to 64 character descriptor of the contents or origins of the pseudocolour table.

 EASI>DBSD="string"
This value is only used if a new pseudocolour segment is created.

MONITOR

Program progress can be monitored by printing the percentage of completed processing in odometer fashion. A system parameter, MONITOR, controls this activity:

 EASI>MONITOR="ON"          | turn monitor ON  (default)
 EASI>MONITOR="OFF"         | turn monitor OFF (recommended if
                            | running in batch/background mode)

DETAILS

PCTMAKE makes a Pseudocolour Table (PCT, segment type 171) using as input a theme channel and three channels representing an RGB (colour) image. The PCT can then be used to colour the theme channel on a display making it appear similar to the RGB image.

Typically the theme channel is the output from one of the clustering programs KCLUS, ISOCLUS, or NGCLUS, and the RGB channels are a visually enhanced version of the channels used in clustering. Other sources can be used as input, however there is no guarantee that the resulting PCT will be meaningful.

The input file (FILE) contains the RGB channels (DBIC) and the theme channel (DBTC) to be used in generating the PCT. An enhancement can be applied to the RGB channels by the use of previously saved Lookup Tables (DBLUT) held in segments on the input file. The generated PCT is saved in a segment on the input file. This can either overwrite an existing PCT or a new segment can be created (DBPCT). If a new segment is created then an 8 character identifying name (DBSN) and a 64 character descriptor (DBSD) are assigned to it. The input theme and RGB channels are not affected. The only output is the generated PCT.

The MASK parameter controls the area of the image that should be used in collecting statistics for generating the PCT. If no values are specified in MASK the entire image is used. If four values are specified then these are assumed to represent a window on the image. If a single value is specified then this is assumed to be a segment number containing a bitmap, where set (on) bits represent pixels to be used.

A value of black (0,0,0) is assigned to entries in the PCT for values which are not represented in the theme channel.

Input theme and RGB channels should be 8-bit. This restriction is due to the 8-bit nature of a Pseudocolour table. While any type of image channel can be used, values are internally converted to 8-bit data. Using non 8-bit data may result in unexpected or poor results.

PCI extends its thanks to William Aymard of the United States Environmental Protection Agency, Environment Monitoring Systems Laboratory, Las Vegas, Nevada, for suggesting this program.

IMAGE COMPRESSION (24 T0 8-BIT)

It is occasionally necessary to compress 24-bit RGB (colour) imagery to 8-bits. The result of the compression is an 8-bit image and a pseudocolour table. When the 8-bit image is shown using the pseudocolour table, a reasonable approximation of the original 24-bit image is achieved.

The common reason to compress 24-bit imagery is to export it to other software systems using special file formats. Since 8-bit display hardware is far more common than 24-bit, many software packages and workstations (for example PCs with VGA cards) work exclusively with this type of data.

The following compression technique can be used:

The program CMPRSS8 gives an alternative method of compressing images to 8-bits. CMPRSS8 may not give quite as good results as the above method but is much faster and can be done in a single step.

ALGORITHM

The Pseudocolour table is generated by finding the average red, green, and blue grey level values in the RGB image for each unique value in the theme channel.

This is done by scanning the entire image and accumulating counts, and red, green, blue grey level sums for each of the 256 (0 to 255) values in the theme channel. Each pixel in the image is examined, the theme channel contributes the value, the corresponding red, green, and blue grey levels for the pixel are accumulated for the value, and the values count is incremented by one.

When the entire image has been scanned, the pseudocolour table is generated where the Nth entry in the pseudocolour table is theme value N, and the colour entries are the red, green, blue sums divided by the corresponding count. Values which have a count of 0 are assigned the output colour black (i.e., 0, 0, 0).

EXAMPLE

The user wishes to perform a classification on the first five channels of raw TM data held in the file, irvine.pix. The method selected is to perform an unsupervised classification using the clustering program KCLUS (or ISOCLUS), then to use the aggregation program AGGREG to aggregate similar clusters. The program PCTMAKE is used to create a Pseudocolour table which can be used with AGGREG. This Pseudocolour table will colour the unsupervised classification so it looks similar to an enhanced image. This coloration makes it easier to locate or identify clusters during aggregation.

First the unsupervised classification (clustering) is performed. KCLUS is used, with 64 clusters selected.

 EASI>FILE="irvine.pix"
 EASI>DBIC=1,2,3,4,5
 EASI>DBOC=7
 EASI>MASK=                             | whole image
 EASI>NUMCLUS=64
 EASI>SEEDFILE=
 EASI>MAXITER=10
 EASI>MOVETHRS=0.01
 EASI>SIGGEN="NO"
 EASI>REPORT="TERM"
If enhancement of raw data is desired, the user can enhance the image and run the VIL program to save the enhanced Lookup tables. See the VIL program documentation for more details.

The program PCTMAKE is used to create a Pseudocolour table matching the true-colour image held in channels 3, 2 and 1. Segments 4, 3, 2 hold Lookup tables which enhance the raw data to improve the image appearance.

 EASI>DBIC=3,2,1
 EASI>DBLUT=4,3,2
 EASI>DBTC=7
 EASI>MASK=                             | whole image
 EASI>DBPCT=                            | create new PCT segment 
 EASI>DBSN="TrueColr"
 EASI>DBSD="True Colour" 
 EASI>RUN PCTMAKE
The results can be seen on the display (if desired):

 EASI>DBIC=7
 EASI>VDOC=1
 EASI>DBIW=
 EASI>VDOW=
 EASI>RUN IVI                           | theme channel to display
 EASI>RUN IVP                           | PCT to display
 EASI>RUN DCP "PD1"                     | show theme using PCT
The program AGGREG is now run to aggregate (label) clusters.


About PCI Help Gateway