Image Expression Type

The Image Expression Language is used by the six calculator functors to evaluate algebraic and logical expressions. The complete operator reference — including full syntax tables, availability notes, null value handling, EGO Script examples, and practical examples — is in Calculate Functors — Complete Operator Documentation.

GUI Editor

Graphical representation of the image expression editor

The editor supports a few interactions that make it easier to work with identifiers:

  • Hovering the mouse over an identifier (i1, t1, v1, etc.) displays a tooltip for the functor and output port it is connected to.
  • Clicking an identifier inserts it at the current cursor position in the expression.
  • If the functor connected to an identifier has an alias, that alias is shown in place of the numbered identifier (i1, t1, v1, etc.), making the expression easier to read.

Note: The editor works exclusively with the verbose form. Abbreviated syntax is converted to verbose form automatically when the script is read. See Calculator functor shorthand and Conversion between forms for details.

Identifiers

In expressions, operands are referenced by type-specific identifiers:

  • iX — a connected map, where X is an integer from 1 to 100
  • tX — a connected table or lookup table, where X is an integer from 1 to 100
  • vX — a connected scalar value, where X is an integer from 1 to 100

Maps are connected via Number Map hook functors, tables via Number Table, and scalar values via Number Value.

In the abbreviated (shorthand) syntax, operands are referenced directly by variable name using type sigils: # for maps, % for tables and lookup tables, $ for values — eliminating the hook block entirely. See Calculator functor shorthand for details.

During logical expression evaluation, zero is false and any non-zero value is true.

Local Variables

A let ... in expression binds intermediate results to local variables named with the _ sigil. Each binding is the variable name, a colon : and its expression, and bindings are separated by commas, for example let _a: i1 * 2, _b: _a + i2 in _a / _b. Local variables are valid in both the verbose and abbreviated syntaxes and in all calculator functors. See Local Variables for the rules.1

Struct Expressions

A struct expression, written { name1: expression1, name2: expression2, ... }, produces several results from one evaluation, one for each named field. It is accepted only by Calculate Multiple Maps, and only as the whole expression or as the body of the let ... in that is the whole expression, so that the fields can share local variables. See Struct Expressions for the rules.1

Null Value Handling

A null value in any operand poisons the entire expression result. The keyword null marks the current evaluation unit as missing — it is an abstract sentinel with no numeric value, available in all six calculator functors. This is distinct from null(iX), which returns the numeric sentinel value stored in a specific image and is only available in map calculators. Two operators interrupt null propagation: isNull() and ?. The power operator ^ also results in 1, not null, when its exponent is 0 or its base is 1. See Null Value Handling for the complete rules, exceptions specific to map calculators, and defensive patterns.

Operators

General Operators

Arithmetic, logical, and conditional operators with full precedence rules, including if/then/else, boolean and/or/not, comparison operators, +, -, *, /, %, ^, and the catch-error operator ?.

→ General Operators

General Functions

Mathematical functions (sqrt, sin, cos, ln, exp, abs, ceil, floor, round, max, min, clamp, clampMod, signal, pi), stochastic functions (rand, rUniform, rNormal, rPoisson), and control functions (abort, isNull(), null). All functions in this section are available in all six calculator functors.

→ General Functions

Value Operators

Retrieves a scalar value connected to a vX port.

→ Value Operators

Image Operators and Functions

Operators that work at the current cell: iX (cell value), iX[line, col] (coordinate lookup with boundary mirroring), null(iX) (numeric sentinel value of image X — distinct from the abstract null keyword), line, and column. Available in Calculate Map, Calculate Categorical Map and Calculate Multiple Maps only; line and column are also available in the two lookup table calculators with row-oriented meanings.

→ Image Operators and Functions

Lookup Table Operators

Single-key lookup table queries using rule-operators: exact match, lower/upper bounds, closest key, linear interpolation, key existence test, and named attribute lookup.

→ Lookup Table Operators

Table Operators

Multi-key table queries using a set of composite keys, returning values from a named, indexed, or default data column.

→ Table Operators

Image Neighborhood Functions

Window-based spatial aggregation: nbMin, nbMax, nbSum, nbProd, nbCount, nbAverage, nbMedian, nbMode, nbVar, nbStdDev. Available in Calculate Map, Calculate Categorical Map and Calculate Multiple Maps only.

→ Image Neighborhood Functions

Image Neighborhood Indexing Functions

Find the cell with the minimum or the maximum value in the window and use its position to retrieve a value from a lookup table or a second image: nbMinRef, nbMaxRef. Available in Calculate Map, Calculate Categorical Map and Calculate Multiple Maps only.

→ Image Neighborhood Indexing Functions

Convolution

Kernel-weighted convolution via nbConvol. Available in Calculate Map, Calculate Categorical Map and Calculate Multiple Maps only.

→ Convolution Operator

Neighborhood Reduce

Combination of the cells of a window into a single value using an accumulator and an expression, via nbReduce. Available in Calculate Map, Calculate Categorical Map and Calculate Multiple Maps only.1

→ Neighborhood Reduce Operator

EGO Script

In an EGO Script .ego file, an image expression is enclosed in square brackets [ ]. The same expression can be written in verbose form (numbered identifiers, hook block required) or abbreviated form (named operands, no hook block). The following example, evaluated for each cell of a raster map, restores noisy pixels using a growing neighbourhood median window — combining multiple maps, a value operand, a neighbourhood function, and the ? catch-error operator:

Verbose form:

if i1 = 2 then
    nbMedian(i2, v1, v1) ? i3
else
    i3

i1 = map flagging original and noisy pixels; i2 = original pixels only; i3 = current restored image; v1 = window size (grows with the current time step). If the neighbourhood median fails (e.g. all neighbours are null), ? falls back to the current restored value i3.

Abbreviated form:

if #arePixelsOriginalOrNoisyWithCategories = 2 then
    nbMedian(#originalPixelsOnlyInRestoredImage, $lK, $lK) ? #currentRestoredImage
else
    #currentRestoredImage

For the full EGO Script syntax — including the hook-block form and conversion between the two — see Calculator functor shorthand.

Automatic Conversions

None — Image Expression Type converts to or from no other type.

See Type System for the complete conversion reference across all types.

  1. Available in Dinamica EGO 8.15.0, currently a development version. Details may change before release. ↩ ↩2 ↩3


This documentation was generated with the help of large language models (LLMs) and may contain errors. Please verify critical information.