### Table of Contents

# FFT

The commands in this submenu support frequency domain display, editing and processing. They are based on an implementation of the 2D Fast Hartley Transform (FHT) contributed by Arlo Reeves, the author of the ImageFFT spinoff of NIH Image. For 3D FHTs, check out Bob Dougherty's 3D Fast Hartley Transform plugin.

### FFT

Computes the Fourier transform and displays the power spectrum. The frequency domain image is stored as 32-bit float FHT attached to the 8-bit image that displays the power spectrum. Commands in this submenu, such as *Inverse FFT*, operate on the 32-bit FHT, not on the 8-bit power spectrum. All other ImageJ commands only “see” the power spectrum.

If the mouse is over an active frequency domain (FFT) window, its location is displayed in polar coordinates. The angle is expressed in degrees, while the radius is expressed in pixels per cycle (p/c). The radius is expressed in [units] per cycle (e.g. mm/c) if the spatial scale of the image was defined using *Analyze/Set Scale*. An example is available.

### Inverse FFT

Computes the inverse Fourier transform. You can filter or mask spots on the transformed (frequency domain) image and do an inverse transform to produce an image which only contains the frequencies selected or which suppresses the frequencies selected. Use ImageJ's selection tools and fill/clear commands to draw black or white areas that mask portions of the transformed image. Black areas (pixel value=0) cause the corresponding frequences to be filtered (removed) and white areas (pixel value=255) cause the corresponding frequences to be passed. It is not, however, possible to both filter and pass during the same inverse transform.

For selections that are off-center, note that the same spatial frequency appears twice in the power spectrum, at points opposite from the center. Since version 1.41k, it is sufficient to fill/clear only one of these for filtering or passing.

There is another example that demonstrates how to remove noise from images generated by a laser scanning confocal microscope.

### Redisplay Power Spectrum

Recomputes the power spectrum from the frequency domain image (32-bit FHT). This command allows you to start over if you mess up while editing the 8-bit power spectrum image.

### FFT Options

A number of options are available:

**Display options**which image(s) are created as output of the FFT command:**FFT Window**is the standard output. It consists of an 8-bit image of the power spectrum and the actual data, which remain invisible for the user. The power spectrum image is displayed with logarithmic scaling, enhancing the visibility of components that are weakly visible. The actual data are used for the Inverse FFT command.

**Raw Power Spectrum**is the power spectrum without logarithmic scaling.

**Fast Hartley Transform**is the internal format used by the command, which is based on a Hartley transform rather than Fourier transform.

**Complex Fourier Transform**is a stack with two slices for the real and imaginary parts of the FFT.

- With
**Do Forward Transform**, the current image is transformed immediately when closing the FFT Options dialog.

### Bandpass Filter...

This is a built in version of Joachim Walter's FFT Filter plugin. It removes high spatial frequencies (blurring the image) and low spatial frequencies (similar to subtracting a blurred image). It can also suppress horizontal or vertical stripes that were created by scanning an image line by line.

**Filter Large Structures Down to … pixels**: Smooth variations of the image with typical sizes of bright or dark patches larger than this value are suppressed (background).

**Filter Small Structures Up to … pixels**: Determines the amount of smoothing. Objects in the image smaller than this size are strongly attanuated. Note that these values are both half the spatial frequencies of the actual cutoff. The cutoff is very soft, so the bandpass will noticeably attenuate even spatial frequencies in the center of the bandpass unless the difference of the two values is large (say, more than a factor of 5 or so).

**Suppress Stripes**: Select whether to eliminate horizontal or vertical stripes. Removal of horizontal stripes is similar to subtracting an image that is only blurred in the horizontal direction from the original.

**Tolerance of Direction**: This is for**Suppress Stripes**; higher values remove shorter stripes and/or stripes that are running under an angle with respect to the horizontal (vertical) direction.

**Autoscale After Filtering**puts the lowest intensity to 0 and the highest intensity to 255, preserving all intensities.

**Saturate**allows some intensities to go into saturation, and produces a better visual contrast. Saturate only has an effect when “Autoscale” is enabled.

**Display Filter**shows the filter generated. Note that this disables Undo of the filter operation on the original image.

The Bandpass Filter uses a special algorithm to reduce edge artifacts (before the Fourier transform, the image is extended in size by attaching mirrored copies of image parts outside the original image, thus no jumps occur at the edges).

### Custom Filter...

This command does Fourier space filtering of the active image using a user-supplied image as the filter. This image will be converted to 8-bit. For pixels have a value of 0, the corresponding spatial frequences will be blocked; pixel values of 255 should be used for passing the respective spatial frequencies without attenuation. Note that the filter should be symmetric with respect to inversion of the center: Points that are opposite of the center point (defined as x=width/2, y=height/2) should have the same value. Otherwise, artifacts can occur.

For some examples, see the FFTCustomFilterDemo and FFTRemoveStreaks macros.

### FD Math...

This command correlates, convolves or deconvolves two images. It does this by converting the images to the frequency domain, performing conjugate multiplication, multiplication or division, then converting the result back to the space domain. These three operations in the frequency domain are equivalent to correlation, convolution and deconvolution in the space domain. Refer to the DeconvolutionDemo and MotionBlurRemoval macros for an examples.

### Swap Quadrants

Swaps quadrants 1 with 3 and 2 with 4. Image points near the center will be moved towards the edge and vice versa. This command transforms between the “user friendly” display of Fourier transforms with the lowest frequencies at the center and the “native” form with the lowest frequencies at the four corners. Another way to see this command is to imagine that the image is periodically repeated and the origin is shifted half the image width in x by and by half the image height in y direction.

For Fourier transforms, swap Quadrants only affects the image displayed, not the actual FHT data. Therefore, editing of an image with swapped quadrants for filtering or masking will not lead to the desired results.