Creating an EASI bitmap mask

Create a bitmap mask (segment 2) which is true (1) everywhere channels 1 and 2 are less than 25. Then this mask and the mask in segment 3 are used to determine a region that should be zeroed in image channels 1 and 2.

if
    (%1 < 25 and %2 < 25)
then
    %%2 = 1
else
    %%2 = 0
endif

if
    (%%2 = 1 and %%3 = 0)
then
    %1 = 0
    %2 = 0
endif

Special Variables

Allow access to information about the size and georeferencing information of channels being operated on and the position of the current pixel. The following special variables may be treated as elements in modeling expressions.

Note that @x, @y, @geox and @geoy change value for each pixel processed, while @dbx, @dby, @meterx, @metery, @sizex and @sizey remain constant over the whole image.

It is usually necessary to use the @x and @y special variables when constructing subscript expressions for channel expressions. For example, the following assignment would mirror an image across a vertical center line. The @dbx is used in computing the center line.

%2 = %1[@dbx-@x+1,@y]

Numeric Expressions

Numeric expressions in EASI are normally operated on in double precision floating point. Values with less precision are promoted to double precision before operations are performed.

A wide set of built-in operations are available in numeric expressions and are listed below with a short description.

A numeric element can be any of the following:

Numeric constants can be entered as decimal or scientific notation numbers with an optional negative sign. Scientific notation is denoted with the 'E' or 'D' character; for example 123000 can be written as 1.23e5, 1.23 * 10 ^ 5

Comparison and logical functions

Example

if
    (%1 = 255) and (%2 = 255) and (%3 = 255)
then
    %%2 = 1
else
    %%2 = 0
endif

Logical expressions

Logical expressions in EASI are used to compute TRUE/FALSE results for use with the IF and WHILE conditional statements. There is currently no way to store a pure logical value in an EASI variable. Logical expressions consist of comparisons between numeric and string expressions combined with the use of the logical operations AND, OR, and NOT.

The equality and inequality tests may be used with two numeric expressions. The equal sign ('=') is used to test for equality, while inequality is tested with '<>' or '!='.

Examples

If( %1 = 0 )
then
...
while( flag <> 1 )
...

The '>', '<', '>=' and '<=' operations may only be performed on numeric expressions.

Examples:

while( total <= 100 )

while( total < 101 )

while( NOT total > 100 )

while( NOT total >= 101 )

The logical operations AND and OR operate on two logical expressions, while NOT operates on one logical expression. The symbols '&', '|' and '!' are considered to be equivalent to AND, OR, and NOT.

Examples:

if( A = 1 AND B = 1 )
then
...
endif

if( A = 1 & b = 1 )
then
...
endif

The IF statement is used to conditionally execute statements.

IF( logical_expression )
THEN
statement_list

[ELSEIF( logical_expression )
THEN
statement_list]

[ELSE
statement_list]

ENDIF
  • logical_expr: a logical expression as described in 'Logical Expression'
  • statement_list: a list of one or more statements

Each logical_expression is evaluated in turn until one of them evaluates to be true. When one is true, the corresponding statement_list will be executed, and control will continue beyond the ENDIF. If none of the logical expressions is true and an ELSE clause exists, the associated statement_list will be executed.

The WHILE command provides a general purpose looping construct.

WHILE( log_expr )
statement_list

ENDWHILE
  • log_expr: a logical expression which is evaluated before each iteration of the loop

The logical expression in the WHILE statement is evaluated. If the result is true, the statement list is executed; otherwise, control skips to the statement following the ENDWHILE. Once the statement list has been executed, control returns to the WHILE statement to test the logical expression again.

It is possible to jump into, or out of, the WHILE loop using the GOTO statement, but this is poor style and may not work in future versions of EASI.

The FOR command provides a simple looping construct over a series of numeric values.

FOR iter_var = start_val TO end_val [BY incr_val]
statement_list
ENDFOR
  • iter_var: the iteration variable. This may be any numeric variable type, including a parameter.
  • start_val: this initial value to assign to the 'iter_var'
  • end_val: when 'iter_var' passes this value, iteration stops
  • incr_val: a value by which to increment 'iter_var' each iteration. The default is 1.

The FOR statement initializes the iteration variable to the initial value, checks it against the end value, and if the end value is not exceeded it executes the statement list. When the ENDFOR statement is reached, the iteration variable is increased by the increment value and compared to the end value. If the end value is not exceeded, the statement list is executed again. The start value may be greater than the end value and the increment value may be negative, but if the increment value does not take the iteration variable value closer to the end value each iteration, the FOR loop will never terminate.

It is possible to alter the value of the iteration variable inside the FOR loop and also to use GOTO to escape or enter the loop, but this is poor style and may cause problems in future versions of EASI.

Example:

The following example runs the task CLR on the first 128 channels of the PCIDSK file irvine128.pix in groups of 16 channels at a time.

local i,j
valu = 0
file="C:\CATALYST Professional\demo\irvine128.pix"
for i = 1 to 128 by 16
for j = 1 to 16
dboc(j) = i + j - 1
endfor
run clr
endfor

Multiple statements

Multiple statements may be placed on the same line by separating the statements with a statement separator. The back slash and semi-colon characters can be used interchangeably for this purpose. A line of input may be almost any length.

Examples

File = "C:\CATALYST Professional\demo\irvine.pix" \ run clr

File = "C:\CATALYST Professional\demo\irvine.pix"; run clr

Single Statements

You may split very long statements over multiple lines by placing a back slash character, not a semi-colon, at the end of each incomplete line.

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