Applies a spectral filter to all pixels of a rectangular region specified by the parameters llx, lly, urx and ury (i.e. lower left to upper right corner in pixel coordinates). The range of spectral data points to be filtered is controlled by the parameters FirstLayer and LastLayer. The parameter TSlot specifies the time slot to be processed.
The filter function is controlled by the coefficients stored in the array parameter FilterKernel. The filter coefficients for a weighted sinc lowpass/highpass filter can be calculated by applying the functions CalcSincLPKernel and CalcSincHPKernel.
If the parameter Feedback is TRUE a visual feedback of the progress of the filtering is provided. Please note that unless the script progress bar is already visible you have to make it visible before calling KFilterSpectra, otherwise the feedback will not be displayed. You can activate the script progress bar by calling the function ScriptBar(0).
Please note that this moving kernel filter creates possibly unwanted edge effects at both ends of the specified spectral range. In order to minimize this effect you should consider to use the function KFilterSpectraEdgeSpecial.
The function returns the following error codes:
0 ... everything is OK
-1 ... FirstLayer or LastLayer is out of range
-2 ... llx..ury are out of range
-3 ... TSlot is out of range
-4 ... FilterKernel is larger than the spectral range