Channels may be specified in a modeling expression using any of the following forms:
%n [(x_expr, y_expr)]
%{ n } [(x_expr, y_expr)] (see Note, below)
%{ file_spec, n } [(x_expr, y_expr)] (see Note, below)
The first case is the channel sign (%) followed by literal numeric value such as 1, 2 or 3, indicating channel 1, 2 or 3 of the implicit database. The second example is similar, but the channel number may be a numeric expression that is evaluated to be the channel number.
The third case is more general yet. The file_spec may be a database filename or a file handle returned by DBOpen(), and the channel number is evaluated as an expression. Overriding the file modifies the database that the channel is assumed to exist on, but the area of operation is still that indicated in the MODEL statement, not necessarily that of the override database.
The following commands are an example of this. The irvine.pix file is 512x512 and eltoro.pix is 1024x1024. The following operation copies channel 1 of eltoro.pix to channel 8 of irvine.pix, but because irvine.pix is the implicit database, the area of operation is 0, 0, 512, 512 and so only the top left quarter of eltoro.pix is copied into channel 8 of eltoro.pix.
MODEL ON "irvine.pix"
%8 = %{"$PCIHOME/demo/eltoro.pix", 1}
ENDMODEL
The second part of the channel specification is the subscript specification which is optional. In the above case, we used the default subscript specification which x --> x, y --> y. The subscript specification allows us to indicate what pixel should be operated on for the current value of X and Y and may be given as an expression.
The following example is similar to the last, but actually assigns a sampled copy of eltoro.pix to irvine.pix. The @x and @y symbols are the current pixel location when the expression is evaluated for each pixel.
MODEL ON "irvine.pix"
%8 = %{"$PCIHOME/demo/eltoro.pix",1} (@x*2+1,@y*2+1)
ENDMODEL
In the above expression, X and Y vary from 0 to 511 as the implicit window of operation is 0, 0, 512, 512 ... the area of irvine.pix. However, channel 1 of eltoro.pix is sampled for values of 1 to 1023. As @x and @y value from 0 to 511, the expression @x*2+1 varies from 1 to 1023.
There are limits on the complexity of the subscript expressions. The MODEL command is implemented in such a way that "chunks" of the database are operated one at a time and the subscripts area evaluated only at the corners of each chunk. As long as the subscript expressions are linear in @x and @y, this is equivalent, but if non-linear expressions or bi-variate expressions are used, then the results will not be that which is expected. These limitations represent an area of research and they may be relaxed at a latter time.
It is also legal for the subscript expressions to extend of the source database. In this case image values from the edge of the database are replicated out as far as is need to satisfy requests. Thus, a simple filter such as the following will work in a reasonable manner, even on the edge of the database.
MODEL
%7 = (%4[@x-1,@y-1] + %4[@x,@y-1] + %4[@x+1,@y-1] + \
%4[@x-1,@y ] + %4[@x,@y ] + %4[@x+1,@y ] + \
%4[@x-1,@y+1] + %4[@x,@y+1] + %4[@x+1,@y+1] ) / 9
ENDMODEL
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.