ADAPT

Make adaptive PCT


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

Back to top

Description


ADAPT generates a pseudocolor table (PCT), which can be used to optimally represent a provided RGB image. The 24-bit image is translated to an 8-bit pseudocolor table using an adaptive PCT algorithm.
Back to top

Parameters


adapt(file, dbic, dbpct, dbsn, dbsd)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBIC * List[int] Input RGB channels 3 - 3  
DBPCT List[int] Output PCT channel 0 - 1  
DBSN str Output segment name 0 - 8  
DBSD str Output segment description 0 - 64  

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the PCIDSK image file containing the imagery channels to process.

DBIC

Specifies the three 8-bit channels (R, G, B) containing the input raster image.

If R, G, and B are all the same channel number, this is equivalent to specifying a black and white image.

DBPCT

Optionally specifies the output pseudocolor table (PCT) channel segment to receive data. If no segment is specified, a new segment is created.

If a new segment is created, the LASC parameter is updated with the segment number.

DBSN

Specifies a name (up to 8 characters) for the output PCT segment.

This value is used only if a new pseudocolor segment is created.

DBSD

Describes (in up to 64 characters) the contents or origins of the output PCT.

This value is used only if a new pseudocolor segment is created.

Back to top

Details

ADAPT creates a pseudocolor table (PCT, segment type 171) using as input three channels (DBIC) representing an RGB (color) image. The 24-bit input image is translated to an 8-bit pseudocolor table using an adaptive PCT algorithm. The PCT may then be used as input to ERRDIFF, which converts an RGB image to a pseudocolored image based on a given PCT.

Input RGB channels (DBIC) must be 8-bit channels, due to the 8-bit nature of a pseudocolor table. While any type of image channel may be used, values are internally converted to 8-bit data. Using non-8-bit data may result in unexpected or poor results.

Back to top

Examples

Convert a 24-bit image into a pseudocolored image before exporting as a TIFF file.

from pci.adapt import adapt

file    =   'map100.pix'
dbic    =   [1,2,3]
dbpct   =   []              # Default, creates new PCT segment
dbsn    =   'Adapt'         # Name for new PCT segment
dbsd    =   ''

adapt(file, dbic, dbpct, dbsn, dbsd)

Use ERRDIFF to transform the RGB image into a pseudocolored image, based on the adaptive PCT.

from pci.errdiff import errdiff

file    =   'map100.pix'
dbic    =   [1,2,3]
dboc    =   [1]
dbpct   =   [3]             # New PCT segment from ADAPT

errdiff(file, dbic, dboc,dbpct)

Convert the 8-bit image to a TIF raster file using FEXPORT.

from pci.fexport import fexport

fili=file
filo='map100.tif'
dbiw=[]
dbic=[1]
dbib=[]
dbvs=[]
dblut=[]
dbpct=[]
ftype='TIF'
foptions=''

fexport(fili, filo, dbiw, dbic, dbib, dbvs, dblut, dbpct, ftype, foptions)

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