FFTofCubeData

Declaration: FFTofCubeData (FirstLayer, LastLayer, FirstTimeSlot, LastTimeSlot, DestLayer, StoreNLSpecLines, FFTLength: integer; Padding: TFFTPadding; FFTResult: TFFTResult; SpecType: TLayerType; LayerCaption: string; Feedback: boolean): integer;
The function FFTofCubeData performs a fast Fourier transform applied to all spectra (pixels) in the time slots from FirstTimeSlot to LastTimeSlot. The signal range to be subjected to the FFT is specified by the parameters FirstLayer and LastLayer. The parameters DestLayer and StoreNLSpecLines control the location where the results of the Fourier transform are stored. The first spectral line is stored in layer DestLayer, the second in DestLayer+1, and so on. A maximum of StoreNLSpecLines are stored.

The parameter FFTLength controls the size of the conversion buffer and must be an integer power of 2. Please note that a larger conversion buffer increases the spectral resolution. If LastLayer-FirstLayer+1 is less than FFTLength the remaining values of the buffer are filled by values determined by the padding mode. The padding mode is specified by the parameter Padding.

The parameter FFTResult controls the kind of spectral data which is stored as the result of the FFT. FFTResult may assume the following values:

ftrReal ... the real part of the spectrum
ftrImag ... the imaginary part of the spectrum
ftrMag ... the magnitude spectrum
ftrPhase ... the phase spectrum
ftrPower ... the power spectrum

The parameter SpecType specifies the spectral type of the calculated spectrum, the parameter LayerCaption determines the caption of the spectral layers (all layers get assigned the same label).

If the Feedback parameter is TRUE a visual feedback is provided. Please note that unless the script progress bar is already visible you have to make it visible before calling FFTofCubeData, 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 ... FFTLength is not a power of 2
-2 ... all spectral groups are used up
-3 ... FirstLayer and/or LastLayer out of range
-4 ... FirstLayer and LastLayer do not belong to the same spectral group
-5 ... FirstTimeSlot and/or LastTimeSlot out of range
-6 ... filtering aborted by user
-7 ... the values of DestLayers and StoreNLSpecLines result in a fragmentation of spectral groups

Example: The following program adds 500 layers to the data cube and stores the first 500 lines of the Fourier transform spectrum into the new layers (assuming that no other data than the one to be transformed is contained in the dataset):
program CalcMagSpec;

const
  FFTLENGTH = 4096;
  SPECLENG = 500;

var
  sl    : integer;

begin
sl := CubeSize[dimL];
AddLayersToDatacube (SPECLENG, 0, true);
FFTofCubeData (1, sl,       // FirstLayer, LastLayer
               1, 1,        // FirstTimeSlot, LastTimeSlot
               sl+1,        // DestLayer
               SPECLENG,    // StoreNLSpecLines
               FFTLENGTH,   // FFTLength
               ftpZero,     // Padding
               ftrMag,      // FFTResult
               ctMagSpec,   // SpecType
               'THz',       // caption
               true);       // Feedback
end.