FFT

MLModule
genre Fourier
authors Markus Hüllebrand, Ola Friman
package FMEwork/ReleaseMeVis
dll MLFFT
definition MLFFT.def
keywords fft, dft, fourier, complex, transformation, spectrum, phase

Purpose

The FFT module calculates a discrete n-D fourier transform of the given image.

Usage

The scalar volume to be processed is attached to input0.

Details

A separable fast Fourier transform is applied along the image dimensions indicated by the user. The discrete nD FFT is computed using the kissFFT library, version 1.2.8. by Mark Borgerding. The fourier transform is computed for a sequence of N real or complex numbers x<sub>0</sub>,…,x<sub>N-1</sub>. The sequence is transformed into X<sub>0</sub>,…,X<sub>N-1</sub> according to the formula:

../../../Modules/ML/MLFFT/mhelp/DFT.PNG

where i is the imaginary unit.

The inverse DFT is given by the formula:

../../../Modules/ML/MLFFT/mhelp/IDFT.PNG

According to the user indicated output type either the complex result, it’s real or imaginary component, the magnitude,

../../../Modules/ML/MLFFT/mhelp/Magnitude.PNG

or the phase,

../../../Modules/ML/MLFFT/mhelp/Phase.PNG

will be computed.

In order to perform a windowed FFT the following windows have been provided and can be selected in the Filter field. The windowing is applied before the transformation, and should only be used when calculating the (forward) FFT.

  • Cosine window:
../../../Modules/ML/MLFFT/mhelp/Cosine.PNG
  • von Hann window:
../../../Modules/ML/MLFFT/mhelp/HanningWindow.PNG
  • Hamming window:
../../../Modules/ML/MLFFT/mhelp/Hamming.PNG
  • Exponential window:
../../../Modules/ML/MLFFT/mhelp/Exponential.PNG
  • Kaiser window:
../../../Modules/ML/MLFFT/mhelp/Kaiser.PNG
  • Sine Bell window:
../../../Modules/ML/MLFFT/mhelp/SineBell.PNG
  • Sine Bell
../../../Modules/ML/MLFFT/mhelp/Tukey.PNG
  • Lanczos window:
../../../Modules/ML/MLFFT/mhelp/Lanczos.PNG
  • Blackman window:
../../../Modules/ML/MLFFT/mhelp/Blackman.PNG

The default parameters have been selected from Matlab.

If Shift frequency center is selected the low frequencies can be reordered to the center of the spectrum. By selecting is the same as the fftshift in Matlab. Therefore the image is swapped iteratively along each dimension. In 2D this leads to a swapping of the first quadrant with the third and the second quadrant with the fourth.

../../../Modules/ML/MLFFT/mhelp/swapQuadrants.png

Windows

Default Panel

../../../Modules/ML/MLFFT/mhelp/Images/Screenshots/FFT._default.png

Input Fields

input0

name: input0, type: Image

input0 must be a scalar volume or complex volume, as it will be implicitly cast to a complex data type. The dimensions of input0 can be chosen arbitrarily.

Output Fields

output0

name: output0, type: Image

The output is the result of the FFT as described above. Depending of the Output Type (see below) the datatype of the output image is either std::complex&lt;MLdouble&gt; or MLdouble.

Parameter Fields

Field Index

Calculate inverse FFT: Bool Size u: Integer
Frequency unit: Enum Size x: Integer
Keep sizes: Bool Size y: Integer
Output: Enum Size z: Integer
preProcessOnly: Bool Window: Enum
Shift Frequency Center: Bool x: Bool
Size c: Integer  
Size t: Integer  

Visible Fields

x

name: xDim, type: Bool, default: TRUE

Select the dimensions to process for the FFT. The page size in this dimension will be set to the image extent.

Size x

name: xDimSize, type: Integer, default: 0

Size y

name: yDimSize, type: Integer, default: 0

Size z

name: zDimSize, type: Integer, default: 0

Size c

name: cDimSize, type: Integer, default: 0

Size t

name: tDimSize, type: Integer, default: 0

Size u

name: uDimSize, type: Integer, default: 0

Calculate inverse FFT

name: calculateInverse, type: Bool, default: FALSE

Output

name: outputType, type: Enum, default: Complex

Values:

Title Name
Complex Complex
Magnitude Magnitude
Phase Phase
Real Real
Imaginary Imaginary

Shift Frequency Center

name: shiftFrequencyCenter, type: Bool, default: TRUE

Reorders frequencies to have low frequencies in center

Window

name: windowFunction, type: Enum, default: None

Values:

Title Name
None None
Cosine Cosine
von Hann vonHann
Hamming Hamming
Exponential Exponential
Gaussian Gaussian
Sine Bell SineBell
Sine Bell Square SineBellSquare
Tukey Tukey
Lanczos Lanczos
Blackman Blackman

Frequency unit

name: frequencyUnit, type: Enum, default: Keep original

Values:

Title Name
Keep original Keep original
Radians/Voxel Radians/Voxel
Periods/Millimeter Periods/Millimeter

Keep sizes

name: keepFFTSize, type: Bool, default: FALSE

Hidden Fields

preProcessOnly

name: preProcessOnly, type: Bool, default: FALSE