Overview
This program will perform a 3D Fourier transform to each xyz volume in the
input with the option to process the data beforehand to remove trends and
smooth discontinuities at the edges.
The controls in the user interface include a
standard set of controls for selecting the input
file, output file, and region of interest and for starting and interrupting
processing. The other controls are organized as follows:
- The direction of the transform and form of the output is controlled by
the three toggles just below the standard output mode and region selection
controls. When the input data is real, the direction of the transform is
always forward, but the output can be fully complex and have both positive
and negative x frequencies present in the output or just have non-negative
frequencies present. In the latter case there is no loss of information,
since the dropped data at (kx,ky,kz) is just the complex conjugate of the
data at (-kx,-ky,-kz). When the input data is complex there are more
options:
- When the Fully complex toggle is off, a reverse transform is
performed to get a purely real result. There is however an ambiguity
about whether the result should have an even or odd number of pixels
in x. If the input data after padding which was supplied to the
forward transform had an even number of pixels in x, turn on the
Even X toggle; otherwise, turn it off.
- When the Fully complex is on, the transform direction can
be either forward or reverse depending on how the Forward
toggle is set.
- Use the Zero frequency centered toggle button to control
the convention for the location of the zero frequency. If the toggle
button is off, the zero frequency is at (0,0,0) (if a reverse transform,
this is relative to the selected input region); otherwise the zero
frequency is at (0, (ny - 1) / 2, (nz - 1) / 2) for real to complex or
complex to real transforms and at
((nx - 1) / 2, (ny - 1) / 2, (nz - 1) / 2) for complex to complex
transforms. For a forward transform, nx, ny, and nz are the input
dimensions after padding; for a reverse transform, nx, ny, and nz are the
input dimensions.
- Use the Shift field to specify a translation
that is applied in conjunction with the transformation. For a forward
transform, a shift of (x, y, z) will
cause pixel (x, y, z) to be shifted to
the origin, (0,0,0). For a reverse transform, the same shift will place
what would appear at the origin, (0,0,0), at pixel (x,
y, z).
- Use the button labelled "Set preprocessing"
to display and change the parameters which control the processing of the
data before it is padded and transformed. Preprocessing can only be done
before forward transforms. By default, no preprocessing is done.
- Use the button labelled "Set window/taper" to
select a function used to smooth out discontinuities at the edges of the
data after preprocessing and before padding and transforming the data.
This option is only available if a forward transform is done. By default,
no smoothing is done.
- Use the button labelled "Set edge handling"
to control the number and values of the elements that are appended to
the input region before the transform. By default, for a forward transform
the input data is padded with zeroes so that it is a size which can be
efficiently processed and on the reverse transform the data is not padded.
- Use the button labelled "Set output size"
to open a dialog with the controls for trimming the output region.
Trimming can only be done when a reverse transform is applied. By
default, no trimming is done.
Because of the nature of the Fourier transform, the handling of the
data header is different than most other Priism applications:
- The pixel format for the output is always complex when a forward
transform is used, and may be complex or real (floating-point) when
the reverse transform is used. The Mode
control is always ignored.
- When performing a forward transform, the sizes in the header are
changed, but the coordinate system information (origin, pixel spacings,
tilt angles) is not converted to frequency units so that when the
reverse transform is performed, the original coordinates are still
available. The starting indices and the number of samples in the header
are set so they refer to the origin and size of the data region before
padding.
- When performing a reverse transform, the sizes and number of samples
in the header are updated to reflect the output size. The coordinate
system information and starting indices are usually unchanged (since
the forward transform did not change them) except if
the size of the region has changed due to padding before the reverse
transform. Then the pixel sizes are scaled by the ratio of the unpadded
size to the padded size and the starting indices are reset to zero since
padding before the reverse transform is equivalent to resampling the data
on a finer grid.
The Fourier transforms calculated have these properties:
- If the Zero frequency centered toggle button is off, the
zero frequency component is at (0,0) (the lower left corner) after a
forward transform, and the component at positive Nyquist in all three
directions is at (nx / 2, ny / 2, nz / 2) where nx, ny, and nz are the
input dimensions after padding. If the Zero frequency centered
toggle button is on and the transform is real to complex, the zero
frequency component is at (0, (ny - 1) / 2, (nz - 1) / 2), and the
component at positive Nyquist in all three directions is at
(nx / 2, ny, nz). If the Zero frequency centered toggle button
is on and the transform is complex to complex in the forward direction,
the zero frequency component is at
((nx - 1) / 2, (ny - 1) / 2, (nz - 1) / 2), and the component at
positive Nyquist in all three directions is at (nx, ny, nz).
- When the forward transform is applied, the result is divided by the
number of pixels in the region. If the data was
tapered it is also further scaled by a factor such
that, if the input had on average a zero mean, the tapering operation
would, on average, not change the variance of the data.
- The sign used in the complex exponential is negative for the forward
transform and positive for the reverse transform.
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size
Related Priism Topics
Priism |
2D Fourier Transform
The Shift field specifies a translation, measured in pixels,
that is applied in conjunction with the transform. The translation is
circular in the sense that something which is pushed off one side wraps
around to the opposite side.
When a forward transform is performed, a shift of (x,
y, z) moves pixel (x, y,
z) to the origin, (0,0,0). For a reverse transform, the same
shift will place what would appear at the origin, (0,0,0), at pixel
(x, y, z).
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size
The input region can be processed to remove an offset or trend before
the data is tapered, padded, and transformed. To display the controls for
this processing, press the button labelled Set preprocessing in the
main dialog. There are five types of processing that can be done; select
one by pressing the appropriate toggle in the dialog. The processing options
are:
- None
- The input is not modified before padding and transforming the
data.
- Subtract offset
- The specified value is subtracted from all the input
values.
- Subtract mean
- For each 3D (xyz) input region, the mean of the region
is subtracted from all values in the region.
- Remove linear trend
- An average slope for each 3D (xyz) input region
is estimated by averaging values from the first and last third of each
dimension; the linear trend corresponding to that average slope and
the mean of the region is subtracted from the input data. The algorithm
used is the average slope method extended to three dimensions (Digital data
analysis procedures, Bendat and Piersol, 1st Edition, 1971, page 288).
- Remove trends up to order
- A polynomial of the given order is fit to
each 3D (xyz) input region. That polynomial evaluated at each input point
is then subtracted from the input before padding and transforming the data.
If you are intending to taper the data and the data does not already have
a zero mean, you should consider using the mean subtraction, linear trend
removal, or polynomial fit options.
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size
Applying a windowing function, also called tapering, multiplies the
data by a function which goes to zero (or near zero) at the edges of the
data. This is done before the forward transform to remove discontinuities
at the edges which can complicate the interpretation of frequency spectra;
the disadvantage of applying a window is that it essentially throws away
parts of the input and it broadens features in the spectra.
The windowing functions used are separable, i.e, the windowing function,
W(x,y,z), can be written as the product of WX(x), WY(y), and WZ(z). WX, WY,
and WZ are calculated from the same formula but with different inputs for the
number of pixels, n, and the fraction, f, of the dimension that is attenuated
by the windowing function. The three values in the
Coverage field are the values of f divided by two for the x, y,
and z directions, respectively. Commonly used values for the coverage are
0.5 (a "full taper") and 0.1 (a 10% taper). The power, x, is used by
half-sine windowing function.
The functions used to calculate the windowing functions are shown below.
i is the pixel index and runs from 0 to n minus 1, and e is given by
{ floor(0.5 + f / 2.0 * n) n even
e = {
{ floor(0.5 + f / 2.0 * (n - 1)) n odd
Rectangular
{ 0 i < e
w(i) = { 1 e <= i <= n - e
{ 0 i > n - e
Because of the sharp cutoffs of the rectangular window, it is
not particularly useful; it's provided for completeness.
Triangular
{ i / e i < e
w(i) = { 1 e <= i <= n - e
{ (n - i) / e i > n - e
Half-sine^power
{ (sin(pi * i / (2 * e)))^x i < e
w(i) = { 1 e <= i <= n - e
{ (sin(pi * (n - i) / (2 * e)))^x i > n - e
Hamming
{ 0.54 - 0.46 * cos(pi * i / e) i < e
w(i) = { 1 e <= i <= n - e
{ 0.5f - 0.46 * cos(pi * (n - i) / e) i > n - e
Blackman
{ cos(pi * i / e) i < e
a(i) = { -1 e <= i <= n - e
{ cos(pi * (n - i) / e) i > n - e
w(i) = 0.34 - a(i) * (0.5 - a(i) * 0.16)
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size
The dimensions of the input region can be extended by adding elements
at the end of each dimension. This is typically done for two reasons:
- Adding the extra elements gives a size that is efficiently handled
by Fourier transforms.
- Adding the extra elements reduces the blending of opposite edges of
the data when filtering or cross-correlations are being performed.
To display the controls for the amount of padding and the values of the
elements added, press the button labelled Set edge handling in the
main dialog. For each dimension the Width field sets the number
of elements that will be added. When the toggle labelled
Use default width is on, the Width field will automatically
be set so the padded size can be efficiently handled. There are three
ways in which the values of the added elements are set. These are:
- Pad with value
- Use the given value for all the elements added to
a dimension. The imaginary component of the value is only used if the
input data is complex.
- Pad with mean
- Use the mean of the 3D (xyz) input region being
processed when padding the dimension.
- Pad with linear ramp
- For each line in x (or column for y
or z-line for z) the padding elements added to the line (or column or
z-line) are a linear combination of the first and last element of that
input line (or column or z-line).
If a forward transform is being done and the data was
tapered, than padding with zeroes is the best choice.
Padding with zeroes is also appropriate if a reverse transform is being done
and you want the grid sampled on a finer grid using Fourier interpolation.
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size
When a reverse transform is performed, the size of the region written to
the output file may be smaller than that of the straight Fourier transform
of the input after padding. Press the button labelled Set output size
to open a dialog with controls for trimming the data. For each dimension,
there is a display of the size of the transformed data and what the
application believes was the size of the data before padding and the forward
transform was applied (this information is read from the number of samples
in the header; it's possible that processing after the forward transform have
altered this field so it may not reflect the original size). The amount
of trimming for each dimension is listed in an editable field.
Topics
Overview |
Region processing |
Shift |
Preprocessing |
Window/taper |
Edge handling |
Output size