SumMatrixMasked

Declaration: SumMatrixMasked (Mat TDouble2DArray; MaskArray: TBool2DArray; var Sum: double): integer;
The function SumArrayMasked calculates the sum of all values of the cells of the matrix Mat which are not masked by the corresponding MaskArray cell and returns the sum in the variable parameter Sum. A TRUE value in a cell of MaskArray masks this cell. The function value returns the number of processed pixels.

The function returns the following error codes:

≥0 ... everything is ok
-1 ... the sizes of Mat and MaskArray do not match
-2 ... Mat has no size at all
Hint: Setting MaskArray to NIL is the same as summing the entire MaskArray with FALSE values (i.e. setting MaskArray to nil does not apply any mask at all).