The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



FrequDistOfArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function FrequDistOfArray (Data: TDoubleArray; LoX, LoY, HiX, HiY: longint; FirstBin, LastBin, BinWidth: double; var FrequDist: TIntArray; var Underflow, Overflow, MaxCnt: longint): integer;
[2] function FrequDistOfArray (Data: TDouble2DArray; LoX, LoY, HiX, HiY: longint; FirstBin, LastBin, BinWidth: double; var FrequDist: TIntArray; var Underflow, Overflow, MaxCnt: longint): integer;
[3] function FrequDistOfArray (Data: TDouble2DArray; Mask: TBool2DArray; LoX, LoY, HiX, HiY: longint; FirstBin, LastBin, BinWidth: double; var FrequDist: TIntArray; var Underflow, Overflow, MaxCnt: longint): integer;

The function FrequDistOfArray calculates the frequency distribution of the values contained in the array Data. The parameters LoX, LoY, HiX and HiY control the region of the data array to be used for the analysis (0-based array index values). Setting all four values to zero is equivalent to using the entire array. In version [3] you may restrict the region which is used for the calculations by using the Mask parameter. Pixels whose corresponding Mask value is TRUE are omitted from the calculations.

The parameters FirstBin and LastBin specify the left (lower) boundary of the first and the last bin of the frequency distribution. The parameter BinWidth defines the width of the bins. A particular bin of the histogram spans the range from FirstBin + i*BinWidth to FirstBin + (i+1)*BinWidth, with i being the bin number (starting from zero). The integer array FrequDist contains the counts of the distribution. FrequDist is automatically resized. Values which don't fit into the histogram (i.e. values which are less than FirstBin, or greater than LastBin + BinWidth) are counted in the variable parameters UnderFlow and OverFlow. The variable parameter MaxCnt returns the maximum count over all bins.

The function returns the following error codes:

 0 ... everything is OK
-1 ... LoX, LoY, LoX, or HiX is out of range
-2 ... LoX/Y must not be greater than HiX/Y
-3 ... FirstBin must not be ≥ LastBin
-4 ... BinWidth must be > 0
-5 ... BinWidth is too small, resulting in too many bins (max. 1000 allowed)
-6 ... Mask does not match the Data array in size



Last Update: 2020-Aug-12