RemoveSpikes

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 Epina ImageLab script progress bar. Please note that unless the script progress bar is already visible you have to make it visible before calling RemoveSpikes, 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, 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