Declaration: RemoveSpikes(HalfWidth, FirstLayer, LastLayer, TimeSlot: integer; UseLinFit: boolean; var SpikeMat: TDouble3DArray; var SpikeList: TIntArray; Threshold: double; FeedBack: boolean): integer;
Removes the detected spikes in all pixels of the hyperspectral image. The function RemoveSpikes implicitly asssumes that the function DetectSpikes has been used before to obtain the parameters SpikeMat and SpikeList.

The spectral range can be restricted by setting the parameters FirstLayer and LastLayer. Please note that in the case of data cubes containing more than one spectral group, you have to set these parameters such that they are specifying layers which belong to the same spectral group (use the function ObtainSpecRange to retrieve the range of a spectral group). The parameter TimeSlot controls the time slot to be processed.

The parameter HalfWidth specifies the expected width of a spike. This parameter has to be set to the same value as is has been used for detecting the spikes in DetectSpikes.

There are two baseline approximation methods available, which are selected by setting the parameter UseLinFit. If UseLinFit is TRUE a linear fit is used, otherwise a parabolic fit is applied to model the baseline.

The function removes all spikes which are specfied in the array SpikeList and whose spike ratio is greater than Threshold and which fall into the datacube region specified by FirstLayer, LastLayer and TimeSlot. In addition the pixels where spikes have been removed are reset to zero values in the three-dimensional array SpikeMat.

If FeedBack is TRUE the progress of the routine is displayed using the ImageLab progress bar.

The function returns the following error codes:

>0 ... everything is OK, the number of removed spikes is returned
-1 ... the HalfWidth is out of range (valid range: 1..100)
-2 ... the LastLayer is less than or equal to the FirstLayer
-3 ... the FirstLayer or the LastLayer are out of range
-4 ... invalid TimeSlot
-5 ... the size of SpikeMat does not match the data cube

Last Update: 2017-Mai-19