**PURPOSE**- Designs optimal 2-D or 3-D filters in Fourier or real space by the use of Remez exchange algorithm and subsequent McClellan transform. Plots Remez, Gauss or Fermi type filters.

**SEE ALSO****FF**[Filter - Fourier] **FQ**[Filter - Quick Fourier, High, low pass, etc., Padded ||] **RC**[Real Convolution ||]

**USAGE**- .OPERATION: FF PLOT

- .(F)ERMI, (G)AUSS, (B)UTTER OR (R)EMEZ FILTER? (F/G/B/R): R

[Enter the name of the filter to be designed. The first three options produce the drawing of the filter for the given set of parameters.] - For Fermi Filter SPIDER asks:
.PLOT X-DIMENSION:

[Enter vertical length of the plot.].(L)OWPASS, (H)IGHPASS, OR (B)ANDPASS? (L/H/B):

[Enter type of the filter to be plotted].FERMI CUTOFF RADIUS, TEMP. FACTOR:

[Enter cutoff frequency and temperature factor.]- For Bandpass filter SPIDER asks:
.FERMI CUTOFF RADIUS.,TEMP.FACTOR:

[Enter cutoff frequency and temperature factor for the second cutoff.]- For Gaussian Filter SPIDER asks:
.PLOT X-DIMENSION:

[Enter vertical length of the plot.].(L)OWPASS, (H)IGHPASS, OR (B)ANDPASS? (L/H/B): B

[Enter type of the filter to be plotted].RADIUS:

[Enter cutoff frequency].(M)ULTIPLICATIVE, (A)DDITIVE:

[Enter type of the filter.]- For Butterworth filter SPIDER asks:
.PLOT X-DIMENSION:

[Enter vertical length of the plot.].(L)OWPASS, (H)IGHPASS (L/H):

[Enter type of the filter to be plotted.].PASS-BAND AND STOP-BAND FREQUENCY:

[Enter the two frequencies.].LIKE AN EXAMPLE WITH STEP FUNCTION??(Y/N):

[If answer is "Y" then it gives the plot of a step function and how it looks like when it is filtered using the Butterworth filter with the given parameters. NOTE: This currently works only for dimension (of plot) equal to powers of two only. If answer is "N" then you are back to operation command].- For Remez filter SPIDER asks:
.IMPULSE RESPONSE LENGTH: 17

[Enter the impulse response length. It should be odd, not larger then 59, and never larger than the actual size of Fourier space filter or smaller than 3.].NUMBER OF BANDS: 3

[Enter the number of pass- or stop- bands in freq. space for a filter to be designed (at least 2).].BAND # i - LOWER AND UPPER EDGES: 0.1,0.14

[Enter the edges boundaries for each band.].BAND # i - DESIRED VALUE: 2.3

[Enter the desired filter for each band (e.g. 0.0 or 0.5 or 1.0 or 3.0).].BAND # i - WEIGHTING: 1

[Enter the weight for each band; this specifies the relative error of approximation allowed in a given band].PLOT FREQUENCY RESPONSE (Y/N): Y

[Enter 'Y' if you want the plot of frequency response].DO YOU LIKE YOUR FILTER (Y/N): Y

[Enter 'Y' if you are satisfied with approximation obtained. Otherwise you go back to the first step.].FILTER FILE: FIL001

[Enter name of file where filter is to be stored.].FILTER DIMENSIONS (NX,NY): 128,64

[Enter dimensions of resulting filter in Fourier space. If 0 then PSF is stored to be subsequently used in 'RC' operation for real space filtering.].NUMBER OF SLICES (NZ): 32

[Enter number of slices for 3-D filter file. If 0 then a 2-D filter is produced, if >0 then a 3-D filter.]- If you answered RETURN for (NX,NY) SPIDER asks:
.PRODUCE 2-D OR 3-D PSF (2/3)?: 3

[Enter 2 or 3, and the file containing Point Spread Function of the appropriate dimensions is stored (to be used for filtering with RC).

**NOTES**

- Frequency units are absolute units (independent of image size)
in the range 0.0 <= f <= 0.5 (0.5 is the highest value).
The following two equations can be used to convert frequency
units into pixel units for (p=0 ... (nx/2) ):

p = 2 * f * (NX / 2)

f = 0.5 * p / (NX / 2)

- For description of the Remez exchange algorithm see any book
on digital filter design.
- For the description of 2-D McClellan
transformation algorithm see:
*'Digital filters and their applications'*Cappellini V., Constantinides A.G., Emiliani P. - For the description of the Butterworth filter see
*Signal processing algorithms*Samuel D.Stearns, Ruth A.David. - Remez option implemented by: Paul Penczek.

**SUBROUTINES**- FILTPLOT, FERMP, GAUSSP, BUTERP, REMEZP, MRKUR3, ROT_P, OPSF_P, ROT3_P, OPSF3_P, INF_Q, INF3_P, FMRS_2, FMRS_3

**CALLER**- FOUR1

© Copyright Notice / Enquiries: spider@wadsworth.org