SpatialPercentileFilter

Declaration: SpatialPercentileFilter (KSize: integer; Prob: double; InData: TDouble2DArray; var OutData: TDouble2DArray; PixMask: TBool2DArray; Feedback: boolean): integer;
SpatialPercentileFilter calculates for each cell of the array InData the Prob-percentile of the matrix cells in a quadratic region with an edge length of KSize. The parameter Prob specifies the probability of the percentile (valid range: 0..100). The results are written to OutData which is automatically resized to match the size of InData.

The parameter PixMask contains an optional pixel mask which controls which cells of the array InData should be processed. A TRUE value excludes the corresponding cell from calculations. Set PixMask to NIL if you do not need the masking feature.

If Feedback is set to TRUE, the progress bar at the bottom of the Epina ImageLab main window indicates the progress of the calculation, if set to FALSE no visual feedback is provided. Please note that unless the script progress bar is already visible you have to make it visible before calling SpatialPercentileFilter, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).

The function returns the following error codes:

 0 ... everything is OK
-1 ... KSize is even
-2 ... KSize is greater than the shorter side of the InData array
-3 ... KSize is less than 3
-4 ... the size of PixMask does not match the size of InData