Environments | PYTHON :: EASI :: MODELER |
Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Examples :: Related |
Back to top |
Back to top |
ipg(file, dbic, dboc, polv)
Name | Type | Caption | Length | Value range |
---|---|---|---|---|
FILE* | str | Input file name | 1 - | |
DBIC* | List[int] | Input channel for analysis | 1 - 1 | |
DBOC* | List[int] | Output polygon layer | 1 - 1 | |
POLV | List[float] | Polygon build selection values | 0 - 16 |
Back to top |
FILE
Specifies the name of the PCIDSK file containing the channel for which to produce polygons.
DBIC
Specifies the input image channel from which to produce polygons. The input channel may not be used as the output channel.
DBOC
Specifies the image channel to receive the output polygon labels. The input channel may not be used as the output channel. The maximum number of polygons that may be produced varies depending on the computer type and the output channel type; see the Details section for more information.
POLV
Specifies the gray-level values that make up 8-connected areas to be defined as polygons.
The first method considers all gray-level values to be distinctly different. This is the default value for this parameter.
The second method considers the image as foreground and background pixels, where the user specifies the range of gray-level values to make up the foreground. All other gray levels outside the specified ranges will be zeroed as background. This is indicated by assigning pairs of values to POLV that make up ranges of gray levels for the foreground. Up to 8 pairs can be specified. In special cases, a single value is also accepted.
Back to top |
IPG identifies 8-connected contiguous groups of pixels of the same gray level (if POLV is unspecified) or specified ranges (if POLV is specified). Each output raster polygon is assigned a unique ascending label. Polygons are 8-connected, which means that pixels within a polygon are connected in 8 directions (up, down, left, right, and 4 diagonal directions). Pixels for image data outside specified ranges, when POLV is specified, are zeroed and will not be reported by the polygon-reporting function POG.
IPG operates with the following limits:
Maximum line width: 65536 Maximum no. of polygons for each output channel type: 8-bit unsigned integer 255 16-bit signed integer 32767 16-bit unsigned integer 65535 32-bit real 131072
If the number of polygons for a given channel is greater than the specified maximum, the scanline and pixel where the maximum was surpassed is reported and polygons are produced up to, but not including, the reported scanline.
The output polygons are numbered in ascending order, primarily to the right and secondarily towards the bottom of the image. The polygons in the output image will be numbered from 1 in the upper left corner to the number of polygons in the image in the lower right corner. Polygons can be connected diagonally by one pixel (see Example). To assign a specific gray level to a polygon to match previously created records in an external database, use REC and LUT to remap the gray levels of the output image after running IPG.
Back to top |
In the following examples, polygon growing is performed on image data that is classified and copied from irvine.pix to irvpol.pix, a new file. Although the classified image is already on channel 7 of irvine.pix, it can be created again using the eight signature segments, as follows:
from pci.mlc import * file='irvine.pix' #Classification using irvine.pix maxl='FULL' #Full Gaussian classification sigfile='' dbs1=[17,18,19,20,21,22,23,24] #Signature segments to use dboc=[7] #Output to work channel 7 probchan=[] mask=[] nullclas='' mlc( file, maxl, sigfile, dbs1, dboc, probchan, mask, nullclas )
Next, create a sub-image in which to copy the upper left corner of the classified image channel:
from pci.cim import * file='irvpol.pix' tex1='' tex2='' dbsz=[16,16] pxsz=[] dbnc=[3] dblayout='' cim( file, tex1, tex2, dbsz, pxsz, dbnc, dblayout )
Copy the classified image data to the newly created sub-image:
from pci.iii import * fili='irvine.pix' filo='irvpol.pix' dbic=[7] dboc=[1] dbiw=[0,0,16,16] dbow=[0,0,16,16] iii( fili, filo, dbic, dboc, dbiw, dbow )
The first run with IPG is with POLV defaulted (unspecified), in which case each contiguous group of pixels with the same gray level is assigned a unique polygon label:
from pci.ipg import * file='irvpol.pix' dbic=[1] dboc=[2] polv=[] ipg( file, dbic, dboc, polv )
Run IPG again, but this time define POLV so that only contiguous groups of pixels with a value of 40 (classified as "Rangeland") are assigned polygon labels and all other values are zeroed as the background polygon:
from pci.ipg import * file='irvpol.pix' dbic=[1] dboc=[3] polv=[40] ipg( file, dbic, dboc, polv )
Print numeric windows of the input classified image (channel 1), and the two output polygon images (channels 2 and 3), using NUM:
from pci.num import * file='irvpol.pix' dbic=[1,2,3] dbiw=[0,0,16,16] num( file, dbic, dbiw )
irvpol.pix [S 3PIC 16P 16L] 23-Sep-92 1 [ 8U] III Supervised Classification Results 23-Sep-92 Offset: ( 0, 0) Size: ( 16, 16) 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 +--------------------------------------------------------------- 1| 40 50 40 80 40 40 80 50 50 40 40 40 50 50 80 40 2| 40 40 50 50 40 40 40 40 40 50 40 40 50 50 50 30 3| 40 40 40 40 50 50 40 40 40 40 50 50 50 50 50 50 4| 40 40 40 40 80 50 50 40 30 40 50 50 50 50 50 50 5| 50 40 40 40 40 50 50 40 40 50 50 50 50 50 50 50 6| 50 40 40 40 40 40 40 50 50 50 50 50 50 50 50 50 7| 40 50 50 40 40 40 40 50 50 50 50 50 50 50 50 50 8| 40 40 40 50 40 40 40 50 50 50 50 50 50 50 50 50 9| 40 40 40 40 40 40 40 50 50 50 50 50 50 50 50 50 10| 40 40 80 40 40 50 50 50 50 50 50 50 50 50 30 40 11| 50 40 40 40 50 50 50 50 50 50 50 50 50 50 30 50 12| 50 40 40 80 30 50 50 50 50 50 50 30 50 40 50 50 13| 40 40 50 50 50 50 50 50 50 50 40 50 50 50 40 50 14| 30 50 50 50 50 50 50 50 50 50 40 50 30 50 40 40 15| 50 50 50 50 50 50 50 50 50 50 50 50 50 50 40 50 16| 50 50 50 30 50 50 50 50 50 50 40 50 30 30 50 50
irvpol.pix [S 3PIC 16P 16L] 23-Sep-92 2 [ 8U] IPG Input Channel: 1; Polygons 1 to 24 23-Sep-92 Offset: ( 0, 0) Size: ( 16, 16) 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 +--------------------------------------------------------------- 1| 1 2 1 3 1 1 4 2 2 1 1 1 2 2 5 6 2| 1 1 2 2 1 1 1 1 1 2 1 1 2 2 2 7 3| 1 1 1 1 2 2 1 1 1 1 2 2 2 2 2 2 4| 1 1 1 1 8 2 2 1 9 1 2 2 2 2 2 2 5| 10 1 1 1 1 2 2 1 1 2 2 2 2 2 2 2 6| 10 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 7| 1 10 10 1 1 1 1 2 2 2 2 2 2 2 2 2 8| 1 1 1 10 1 1 1 2 2 2 2 2 2 2 2 2 9| 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 10| 1 1 11 1 1 2 2 2 2 2 2 2 2 2 12 13 11| 14 1 1 1 2 2 2 2 2 2 2 2 2 2 12 2 12| 14 1 1 15 16 2 2 2 2 2 2 17 2 18 2 2 13| 1 1 2 2 2 2 2 2 2 2 19 2 2 2 18 2 14| 20 2 2 2 2 2 2 2 2 2 19 2 21 2 18 18 15| 2 2 2 2 2 2 2 2 2 2 2 2 2 2 18 2 16| 2 2 2 22 2 2 2 2 2 2 23 2 24 24 2 2
irvpol.pix [S 3PIC 16P 16L] 23-Sep-92 3 [ 8U] IPG Ranges:40 23-Sep-92 Offset: ( 0, 0) Size: ( 16, 16) 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 +--------------------------------------------------------------- 1| 1 0 1 0 1 1 0 0 0 1 1 1 0 0 0 2 2| 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 3| 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 4| 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 5| 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 6| 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 7| 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 8| 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 9| 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 10| 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 3 11| 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 12| 0 1 1 0 0 0 0 0 0 0 0 0 0 4 0 0 13| 1 1 0 0 0 0 0 0 0 0 5 0 0 0 4 0 14| 0 0 0 0 0 0 0 0 0 0 5 0 0 0 4 4 15| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 16| 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0
© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.