Declaration: CreatePixMaskFromCube(Mask, Layer, TimeSlot: integer; Threshold: double; CompareMode: TCompareMode; MaskOp: TMaskOp; var NumPixels: integer): integer;
Calculates a pixel mask by comparing the values of a specific layer (specified by the parameters Layer and TimeSlot) to the threshold defined by the parameter Threshold. The result of the comparison (a pixel mask) is combined with the mask specified by the Mask parameter. The type of comparison is controlled by the parameter CompareMode. The type of combination is controlled by MaskOp.

The CompareMode parameter may take one of the following values:

cmLT ... value is less than the threshold
cmGT ... greater than
cmLE ... less or equal
cmGE ... greater or equal
cmEQ ... equal to
cmNE ... not equal to
Please note that the modes cmEQ and cmNE only make sense if the values are integer numbers otherwise the comparison might not work (due to round-off errors). The MaskOp parameter may take one of the following values:
moCopy ... copy the calculated pixel mask to the specified mask
moAdd ... add the calculated pixel mask to the specified mask by a logical OR of the calculated and the specified mask.
moRemove ... subtract the calculated pxel mask from the existing mask by applying a logical AND NOT
moInvert ... invert the pixels of the existing mask at positions where the calculated mask pixels are TRUE
The variable parameter NumPixels returns the number of pixels which fulfill the compare condition. The function returns one of the following error codes:
 0 ... everything is OK
-1 ... specified mask does not exist
-2 ... either the layer or the time slot is out of range