RAW2CHIP

Automatic Chip Extraction


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Return Value :: Details :: Example

Back to top

Description


RAW2CHIP performs automatic chip extraction from a raw image and ground control point (GCP) segment to a chip database. It creates chips around each of the GCPs.
Back to top

Parameters


raw2chip(file, dbic, dbgc, backval, mmseg, resample, chipfile, chipsens, chipdate, chipsize)

Name Type Caption Length Value range
FILE * str Input file name 1 -   1 - 3
DBIC * List[int] Input raster channels 1 - 3  
DBGC List[int] Input GCP segment 0 - 1  
BACKVAL List[int] Background data value 0 - 3  
MMSEG List[int] Math model segment 0 - 1  
RESAMPLE str Resampling mode 0 - 6 NEAREST, BILINEAR, CUBIC
Default: CUBIC
CHIPFILE * str Chip database file name 1 -    
CHIPSENS str Sensor origin of chips 0 - 16  
CHIPDATE str Chip acquisition date 0 - 21  
CHIPSIZE List[int] Size of chips (pixel, line) 0 - 2 64,64 - 256,256
Default: 64,64

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the PCIDSK file that contains the raw input image for processing.

DBIC

Specifies the input raster channels that contains the Ground Control Points.

DBGC

Specifies the Ground Control Point segment or layer number in the input raw image from which to extract chips.

If empty, this parameter uses the last segment in the input file.

BACKVAL

Specifies the background, or no-data value, of the input file.

If empty, all pixels are considered as valid data. Selected chips contain no background pixels.

In some cases, chips must be rejected; for example, if the center of a chip is located on a background value, or if a chip contains more than 50 percent background value.

MMSEG

Specifies the math model segment or layer that contains a math model (any type) for the input image. This value is used as the approximate position of the image for creating the chips.

If empty, this parameter uses the last math model segment in the input file.

RESAMPLE

Specifies the type of resampling method that is used.

Resampling extracts and interpolates the gray levels from the original pixel locations to corrected locations.

Three resampling modes are supported.

The default value is CUBIC.

CHIPFILE

Specifies the name of the chip database in which to store extracted chips. If the specified file already exists, new chips are appended to it; otherwise, a new .cdb file is created.

CHIPSENS

Specifies the sensor origin of the newly created chips; for example "Spot".

This is a free-format sensor name that is used elsewhere to identify chips to match with other features. The sensor name is limited to 16 characters.

CHIPDATE

Specifies the acquisition date of the geocoded file.

A regular expression for chip dates (ddmmmyyyy) is acceptable. This information may be used elsewhere to identify chips matching a specific time period.

CHIPSIZE

Specifies the size of each extracted chip, in pixels x lines. The minimum chip size is 64x64; this is the default value. The maximum chip size is 256x256.

Back to top

Return Value

Returns: execution status

Type:  PCI_INT

The return value is 0. This function returns only if it executes successfully; otherwise, it throws an exception.

Back to top

Details

RAW2CHIP automatically extracts chips from raw image files containing Ground Control Point (GCP) segments and stores them in a chip database.

The function collects information from the GCPs (XYZ, ID, pixel and line location, and projection system) and the raw image that corresponds to a feature, and outputs to a chip database that contains chips for all the GCPs in the specified segment.

Back to top

Example

Extract a set of chips from Spotleft.pix with the GCPs stored in segment 3. Save the extracted chips in spot_example.cdb.

from pci.raw2chip import raw2chip

file	=	"Spotleft.pix"
dbic	=	[1]
dbgc	=	[3]
backval	=	[0]
mmseg	=	[4]
resample	=	"CUBIC"
chipfile	=	"spot_example.cdb"
chipsens	=	"SPOT"
chipdate	=	"31DEC2005"
chipsize	=	[64, 64]

raw2chip( file, dbic, dbgc, backval, mmseg, resample, \
chipfile, chipsens, chipdate, chipsize )

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