Content deleted Content added
Adding short description: "System that provides database services specifically for arrays" (Shortdesc helper) |
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags |
||
Line 39:
The '''marray''' operator creates an array over some given ___domain extent and initializes its cells:
<
marray index-range-specification
values cell-value-expression
</syntaxhighlight>
where ''index-range-specification'' defines the result ___domain and binds an iteration variable to it, without specifying iteration sequence. The ''cell-value-expression'' is evaluated at each ___location of the ___domain.
'''Example:''' “A cutout of array A given by the corner points (10,20) and (40,50).”
<
marray p in [10:20,40:50]
values A[p]
</syntaxhighlight>
This special case, pure subsetting, can be abbreviated as
<
A[10:20,40:50]
</syntaxhighlight>
This subsetting keeps the dimension of the array; to reduce dimension by extracting slices, a single slicepoint value is indicated in the slicing dimension.
'''Example:''' “A slice through an x/y/t timeseries at position t=100, retrieving all available data in x and y.”
<
A[*:*,*:*,100]
</syntaxhighlight>
The wildcard operator ''*'' indicates that the current boundary of the array is to be used; note that arrays where dimension boundaries are left open at definition time may change size in that dimensions over the array's lifetime.
Line 68:
'''Example:''' “Array A, with a log() applied to each cell value.”
<
marray p in ___domain(A)
values log( A[p] )
</syntaxhighlight>
This can be abbreviated as:
<
log( A )
</syntaxhighlight>
Through a principle called ''induced operations'',<ref>Ritter, G. and Wilson, J. and Davidson, J.: Image Algebra: An Overview. Computer Vision, Graphics, and Image Processing, 49(1)1994, 297-336</ref> the query language offers all operations the cell type offers on array level, too. Hence, on numeric values all the usual unary and binary arithmetic, exponential, and trigonometric operations are available in a straightforward manner, plus the standard set of Boolean operators.
The '''condense''' operator aggregates cell values into one scalar result, similar to SQL aggregates. Its application has the general form:
<
condense condense-op
over index-range-specification
using cell-value-expression
</syntaxhighlight>
As with ''marray'' before, the ''index-range-specification'' specifies the ___domain to be iterated over and binds an iteration variable to it{{snd}} again, without specifying iteration sequence. Likewise, ''cell-value-expression'' is evaluated at each ___domain ___location. The ''condense-op'' clause specifies the aggregating operation used to combine the cell value expressions into one single value.
'''Example:''' "The sum over all values in A."
<
condense +
over p in sdom(A)
using A[p]
</syntaxhighlight>
A shorthand for this operation is:
<
add_cells( A )
</syntaxhighlight>
In the same manner and in analogy to SQL aggregates, a number of further shorthands are provided, including counting, average, minimum, maximum, and Boolean quantifiers.
Line 106:
'''Example:''' "A histogram over 8-bit greyscale image A."
<
marray bucket in [0:255]
values count_cells( A = bucket )
</syntaxhighlight>
The induced comparison, ''A=bucket'', establishes a Boolean array of the same extent as ''A''. The aggregation operator counts the occurrences of ''true'' for each value of ''bucket'', which subsequently is put into the proper array cell of the 1-D histogram array.
|