Parent Topic: Language

Variables

Variables give access to image (layer) pixel values, attribute data and other values. Variables are identified by a special leading character (#,%,@,$) followed by 1 to 7 characters.

Layer Variables
Layer variables are identified by the leading character `%'. Layer variables take on the grey level value of the pixel being processed for a particular layer (image channel). For example, %3 would take on the grey level value of the third image channel at the current pixel position. If a name is used (e.g., %tree), then the association between the name and an explicit layer is made when the model is first run using a SET or INPUT statement.

 Syntax:    %x, %n

 Examples:  %soil,%z,%1,%23
Attribute Variables
Attribute variables are identified by the leading character `%' and a '.'. Attribute variables take on the value of an attribute associated with the layer through the grey level value. For example, %2.3 would be evaluated as follows: at the current pixel location, the grey level value for the second image channel would be used as a key to a single line of attribute data associated with the layer; within this line, the list of attributes would be scanned and the third attribute value extracted; %2.3 would take on this value. Note that this value could be numeric or character depending on the actual nature of the attribute.

 Syntax:    %x.i, %n.i

 Examples:  %slope.2, %5.3
Subscripts
It is possible to access the grey level values and attribute data for adjacent pixels by subscripting layer or attribute variables. The following diagram shows the subscript syntax and relationship to the pixel being currently processed (which is [ 0, 0]).

                [-1,-1]  [ 0,-1]  [ 1,-1]
                [-1, 0]  [ 0, 0]  [ 1, 0]
                [-1, 1]  [ 0, 1]  [ 1, 1]
Examples: %1.2[-1,-1], %1[1,1]

%x is equivalent to %x[0,0]. Subscripted pixels which are outside the bounds of the image are automatically assigned the value of the nearest pixel which is inside the image.

Note: it is NOT possible to assign a value to a subscripted pixel.

Numeric Variables
Numeric variables are identified by the leading character `#'. Numeric variables are used for temporary storage of numeric values. They have no relation to any layers or attributes and provide a convenient way of holding results of calculations or user entered constants.

 Syntax:    #x

 Examples:  #tree, #t37
Character Variables
Character variables are identified by the leading character `$'. Character variables are used for temporary storage of character data. They have no relation to any layers or attributes and provide a convenient way of holding user entered character data.

 Syntax:    $x

 Examples:  $name,$a
Numeric Array Variables
Numeric array variables are identified by the leading character '#' followed by 1 to 7 characters and an array subscript. Subscripts can range from 1 to the number of elements in the numeric array.

 Syntax:  #x[n]

 Examples: #array[7], #colval[127]
Numeric array variables allow access to one dimensional array information held in PCIDSK array segments [type ARR:181].

Special
Special variables allow access to information about the file and location information about the pixel being processed. They can be used within numerical expressions like constants.

Variable Description

 @x             current x (pixel) processing location
 @y             current y (line ) processing location
 @dbx           size of database in x (pixel) direction
 @dby           size of database in y (line ) direction
 @metrex        size of a pixel in x direction in metres
 @metrey        size of a pixel in y direction in metres
 @geox          x georeferenced centre of current pixel
 @geoy          y georeferenced centre of current pixel
 @sizex         x size of a pixel in georeferenced units
 @sizey         y size of a pixel in georeferenced units

Parent Topic: Language
About PCI Help Gateway