PCE

Pseudocolor encoding


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Acknowledgements

Back to top

Description


Encodes an input channel into three output channels (red, green, and blue components) using a pseudocolor table held in a database segment.
Back to top

Parameters


pce(file, encoding, dbic, dbpct, dboc, dbiw)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
ENCODING str Pseudocolor encoding mode 0 - 4 NORM | OVER
Default: NORM
DBIC * List[int] Input raster channel 1 - 1  
DBPCT * List[int] Input pseudocolor table channel 1 - 1  
DBOC * List[int] Output raster channels 3 - 3  
DBIW List[int] Raster input window 0 - 4 Xoffset, Yoffset, Xsize, Ysize

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the PCIDSK file containing the channel to be pseudocolored.

ENCODING

Specifies the pseudocolor encoding mode.

Available options are:

DBIC

Specifies the input channel to encode.

The input channel should be 8-bit.

DBPCT

Specifies the input segment (type 171) that holds the pseudocolor table.

DBOC

Specifies the three output channels to receive the encoding results (red, green, and blue).

DBIW

Optionally specifies a rectangular subset of the image to be processed. If this parameter is not specified, the entire image is processed by default.

Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

Back to top

Details

PCE is used to encode an input channel (DBIC) into three output channels (DBOC, where DBOC(1) = red output channel, DBOC(2) = green, and DBOC(3) = blue) using a pseudocolor table held in a database segment (DBPCT).

Encoding is performed over the raster input window (DBIW), if one is specified; otherwise, the entire image is processed by default.

A special feature of PCE is that pixel values of zero in the input channel (DBIC) are NOT encoded into the three output channels if the encoding method (ENCODING) is set to "OVER". This leaves the underlying values unaltered, allowing the input channel to be overlaid on the original data already in the output channels. For example, given that the specified output channels (DBOC) contain image data and the input channel (DBIC) is a classification from the MLC function, only the 'classified' pixels would be encoded, because unclassified (or null-class) pixels have a value of zero. The result would be a false color image with classified regions embedded in the image.

The primary use of PCE is to create red, green, and blue color channels for output to a video display or hardcopy output. Often, these channels can be written to tape and sent to other installations for photographic or color plotter reproduction.

For example, given the following pseudocolor table and 4x4 initial data channels:

 Pseudocolor table
 input   output        DBIC       DBOC(1)     DBOC(2)     DBOC(3)
 level   R  G  B                  (Red)       (Green)     (Blue)

   0     7  7  7      0 0 0 0     1 1 1 5     4 4 4 3     3 3 2 3
   1     8  3  0      1 1 0 0     1 1 1 1     1 1 1 1     9 9 9 9
   2     8  5  1      2 3 0 0     1 1 1 1     1 1 1 1     9 9 9 9
   3     2  0  1      0 0 0 0     1 1 1 1     1 1 1 1     9 9 9 9
   4     9  9  9
  ...
  255    .  .  .

With the encoding mode set to "NORM", output for the three output channels would be as follows:

            DBOC(1)        DBOC(2)        DBOC(3)

            7 7 7 7        7 7 7 7        7 7 7 7
            8 8 7 7        3 3 7 7        0 0 7 7
            8 2 7 7        5 0 7 7        1 1 7 7
            7 7 7 7        7 7 7 7        7 7 7 7

With the encoding method set to "OVER", output for the three output channels would be as follows:

            DBOC(1)        DBOC(2)        DBOC(3)

            1 1 1 5        4 4 4 3        3 3 2 3
            8 8 1 1        3 3 1 1        0 0 9 9
            8 2 1 1        5 0 1 1        1 1 9 9
            1 1 1 1        1 1 1 1        9 9 9 9
Note: The R,G,B values for the zero gray level in the pseudocolor table are not ignored in this case.
Back to top

Examples

Assume that the file "PCETEST.PIX" contains the following:
  • Channels 1,2,4: raw imagery data
  • Channel 6: classification result from MLC
  • Segments 7,8,9: lookup tables for channels 1,2,4
  • Segment 10: pseudocolor table for channel 6

Embed the classification results in channel 6 into the raw imagery (for later output to hard copy). First, use the LUTs for the raw channels 1, 2, and 4 to bulk-enhance them so that they show up well; then, encode the classification results.

from pci.lut import lut
from pci.pce import pce

fili	=	'pcetest.pix'	# input file
filo    =   'opcetest.pix'
dbic	=	[1,2,4]	# input channels
dblut	=	[7,8,9]	# input LUT segment
dboc	=	[1,2,4]	# overwrite input channels


lut ( fili, dbic, dblut=dblut, dboc=dboc, filo=filo )  # enhancement

encoding	=	'OVER'	# encoding mode
dbic	=	[6]	# channel to be encoded
dbpct	=	[10]	# segment holding PCT table
dboc	=	[4,2,1]	# LANDSAT 2 RGB false-color
dbiw	=	[]	# process entire image

pce( filo, encoding, dbic, dbpct, dboc, dbiw )

Completely encode input channel 6, which contains USGS Land Use/Land Cover data, using the associated pseudocolor segment 7, with the output going into three output channels (red=7, green=8, blue=9).

from pci.pce import pce

file	=	'irvine.pix'	# input file
encoding	=	'NORM'	# encoding mode
dbic	=	[6]	# channel to encode
dbpct	=	[7]	# segment holding PCT table
dboc	=	[7,8,9]	# encoding results (R,G,B)
dbiw	=	[]	# process entire image

pce( file, encoding, dbic, dbpct, dboc, dbiw )
Back to top

Acknowledgements

PCE functionality is based on a program submitted by Mit Tilkov of Cominco Ltd., developed using B.C. Research facilities.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.