Declaration: CreateBackgroundMask(FirstLayer, LastLayer, TimeSlot: integer; Percentile: double; var PixMask: TInt2DArray; FeedBack: boolean): integer;
Calculates two pixel masks indicating those pixels which do not contain any important spectral information ("background pixels"). See here for an explanation of the algorithm.

The parameters FirstLayer and LastLayer specify the range of layers to be used for the calculation. The parameter TimeSlot specifies the time slot to be used. The parameter Percentile determines the threshold for determining non-background pixels. Its valid range is between 0.0 and 50.0, useful values are normally between 2 and 15. The higher this value the less pixels will be recognized as background pixels. The found background pixels are stored in the array PixMask, which is automatically resized to the size of the data cube. Bit 0 of each cell corresponds to an intensity deviation towards minus infinity, bit 1 indicates not deviation toward plus infinity. The Feedback determines whether a visual feedback is provided.

The function returns the following error numbers:

 0 ... everything is OK
-1 ... FirstLayer and/or LastLayer is out of range
-2 ... TimeSlot is out of range
-3 ... Percentile is out of range
-4 ... calculation aborted by user by pressing <ESC>

Last Update: 2017-Jšn-24