FF - Filter - Fourier

(1/29/18)

PURPOSE

Applies filters to 2-D or 3-D Fourier transforms. If you want to filter a real image (not a Fourier image) use operation 'FQ' or 'FQ NP' instead.
NOTE: Butterworth filters altered to put 50% transfer in middle of requested cutoff band in Jan 2018.   Example.

SEE ALSO

FQ [Filter - Quick Fourier, High, low pass, etc., Padded ||]
FQ NP [Filter - Quick Fourier, High, low pass, etc, No Padding ||]
FT [Fourier Transform ||]
FF PLOT [Fourier - Filter design]
FD [Fourier filter image/volume according to a Document file ||]
FP [Interpolate/Resize using Fourier transform ||]
FT [Fourier Transform ||]

USAGE

.OPERATION: FF

.INPUT FILE: FOU001
[Enter name of input image file which contains a Fourier transform.]

.OUTPUT FILE: FOU002
[Enter name for output file which will receive the filtered Fourier transform.]

Filter options.

1 - LOW-PASS, 2 - HIGH-PASS,
3 - GAUSS. LOW-PASS, 4 - GAUSS. HIGH-PASS,
5 - FERMI 6 - FERMI,
7 - BUTTER. LOW-PASS, 8 - BUTTER. HIGH-PASS,
9 - REMEZ, 10 - B FACTOR,
11 - SAMPLED SPACE')

.FILTER TYPE (1-11): 3
[Enter filter option code. In the following F is the current spatial frequency.

Option "1" - Low-pass. truncation. Filter is a "top-hat" function that preserves frequencies below Fcut only.

Option "2" - High-pass. truncation. Filter is inverse "top-hat" function that preserves frequencies above Fcut only.

Option "3" - . Filter is the Gaussian function: EXP(-F**2 / (2 * Frad**2)). Note that Frad is about where the transfer falls to 60% not 50%.

Option "4" - . Filter is complement of the Gaussian function: 1 - EXP(-F**2 / (2 * Frad**2)) . Note that Frad is about where the transfer falls to 60% not 50%.

Option "5" - Fermi low-pass. Filter is: 1 / (1 + EXP[(F - Frad) / T]) which negotiates between "Top-hat" and Gaussian characteristics, depending on the temperature value:T (see below).

Option "6" - Fermi high-pass. Filter is: 1 / (1 + EXP[(F - Frad) / -T]). Same as in Fermi low-pass, but with T replaced by -T.

Option "7" - Butterworth low-pass. Filter is: 1 / (SQRT(1 + (SQRT(2.0)-1) * F / RAD)**(2 * ORDER)) where 'eps' is hard coded = 0.882.
ORDER = [2 * log(eps/SQRT(**2-1)) ] / [log(Flow/Fhi)] and
RAD = Flow / ((eps)**(2 / ORDER))
The ORDER determines the filter fall off and RAD corresponds to a cut-off radius.
Preserves frequencies below <i>FlowFhi,
with a smooth transition in between lower and upper limiting frequencies.

Option "8" - Butterworth high-pass. Filter is: 1 - (1 / (SQRT(1 + (SQRT(2.0)-1) * F / RAD)**(2 * ORDER)))
Removes frequencies below <i>FlowFhi,
with a smooth transition in between lower and upper limiting frequencies.

Option "9" - Raised Cosine low-pass. Filter is:
0.5 * (COS(PI * (F - Flow) / (Flow - Fhi)) + 1) if Flow < F < Fhi,
1 if F < Flow, and 0 if F > Fhi.

Option "10" - Raised Cosine high-pass. Filter is:
0.5 * (-COS(PI*(F - Flow) / (Flow - Fhi)) + 1) if Flow < F < Fhi,
0 if F < Flow, and 1 if F > Fhi.

For options "1-2" SPIDER asks:

.FILTER RADIUS (IN FREQUENCY OR PIXEL UNITS): 0.12 or 5
[The filter radius (filter intrinsic frequency) can be input using either frequency units or pixel units. If filter radius is given in frequency units, they should be in the range: 0.0 - 0.5. If the input is > 1.0 it is treated as given in pixel units. (The frequency is then 1 / radius). This frequency is referred to above as: Fcut.]

For options "3-4" SPIDER asks:

.FILTER RADIUS (IN FREQUENCY OR PIXEL UNITS): 0.12 or 5
[The filter radius (filter intrinsic frequency) can be input using either frequency units or pixel units. If filter radius is given in frequency units, they should be in the range: 0.0 - 0.5. If the input is > 1.0 it is treated as given in pixel units. (The frequency is then 1 / radius). This frequency is referred to above as: Frad.]

For options "5-6" SPIDER asks:

.FILTER RADIUS (IN FREQUENCY OR PIXEL UNITS): 0.12 or 5
[The filter radius (filter intrinsic frequency) can be input using either frequency units or pixel units. If filter radius is given in frequency units, they should be in the range: 0.0 - 0.5. If the input is > 1.0 it is treated as given in pixel units. (The frequency is then 1 / radius). This frequency is referred to above as: Frad.]

.TEMPERATURE (0=CUTOFF): 0.3
[Enter a temperature parameter T The filter falls off roughly within this reciprocal distance (in terms of frequency units).]

For options "7-8" SPIDER asks:

.LOWER & UPPER LIMITING FREQUENCIES (IN FREQ OR PIXEL UNITS): 0.1, 0.2
[The Filter limiting frequencies can be given either in frequency units or pixel units. If limiting frequencies are given in frequency units, they should be in the range: 0.0 - 0.5. If limiting frequencies are > 1.0 they are treated as given in pixel units. (The frequency is then 1 / radius). Both values must be in the same units. These values expressed as frequencies are denoted: Flow and Fhi.]

For option "9" SPIDER asks:


.FILTER FILE: REM000
[This file can be created by 'FF PLOT', or it can be any Fourier file used as a filter.]

For option "10" SPIDER asks:


.B FACTOR (PIXEL**2): 5
[B Temperature factor. Units are pixel**2. A positive value sharpens the image.]

.D MULTIPLIER CONSTANT: 1
[Multiplier.]

.FREQUENCY CUTOFF: 0.5
[ This frequency is referred to above as: Fcut. Values >= .5 have no effect.]

]

NOTES

  1. 'FQ' has similar functions.

  2. The FILTER RADIUS and LOWER & UPPER LIMITING FREQUENCIES can be given either in frequency units (F) or pixel units (P). If the input is > 1.0 it is treated as given in pixel units.

    Frequency units are absolute units (independent of image size) in the range: 0.0 - 0.5 (0.5 is the highest value).
    The following equations convert frequency units into pixel units for (P in range: 0 - (NX/2)):
    P = F * NX
    F = P / NX

SUBROUTINES

FFILTS, BFACT

CALLER

FOUR1