# How to understand the basis sinusoids of 3D FFT?

I understand intuitively the concept of Fourier transforms of 1D signals and 2D images. In the case of a 1D signal, an FFT gives the relative contribution of sinusoids with different frequencies and phases for reconstructing the original 1D signal -- thus there are three free parameters in 1D: the frequency, phase shift, and amplitude of each sinusoid. In 2D, it's the same idea: any image can be reconstructed by summing over sinusoids of many different amplitudes, frequencies, phase shifts as well as a new parameter: the 2D rotation angle of each sinusoid.

However I am struggling to visualize and intuitively understand the basis sinusoids of a 3D FFT. Again the idea here is that a discrete 3D dataset can be decomposed as the sum over many different 3D sinusoids. But what do these 3D sinusoidal basis functions look like and what are their free parameters? Of course every 3D sinusoid component will still have an associated

• amplitude (globally the same for a given sinusoid?)
• wavelength (is it just one, or two -- one for each of the orthogonal directions?)
• orientation (not just one angle as in 2D, but maybe two angles -- azimuthal and polar?)
• phase shift (again just one, or would it be two for each of the orthogonal directions?)
• are there other sinusoid parameters unique to 3D FFT? does it depend on geometry?

And how is the above different if you have a 3D scalar field vs. 3D vector field? I guess in the 3D vector field case, you just compute the FFT over each of the vector components separately?

If possible, a simple 3D FFT visualization example akin to this beautiful 2D FFT write-up would be helpful. (In Python using numpy/scipy.)

• Are you talking about 2D and 3D Fourier transforms in Cartesian coordinates? Because the 2D rotation of the sine wave is a derived parameter in that space -- the actual transform simply does successive transforms on the rows and columns (or columns and rows -- the order doesn't matter) of the 2D data set. The $N^{th}$-degree FFT of data in Cartesian coordinates is more or less the same -- do the 1$^{st}$ axis, then the 2$^{nd}$, etc., until you're done. Any "sine waves at an angle" is an emergent property in the result. Dec 29, 2022 at 20:25
• Yes I'm talking about Cartesian coordinates for both the 2D and 3D Fourier transform. What do the individual component sinusoids look like in the 3D case -- compared to the usual grayscale 2D sinusoids with alternating white/black stripes? That's what I'm having trouble visualizing... Dec 29, 2022 at 20:32

To understand the Fourier Transform (and FFT) in 3 or more dimensions, you first have to get what it "operates over".

• The 1D FFT operates over a time series. That is, discrete measurements of a quantity over time. For example, a transducer's voltage or the height of a sea wave over time.

• The 2D FFT operates over a scalar field. That is, discrete measurements of a quantity over space. For example, light variations over the surface of a CCD (an image).

• A 3D FFT operates over a scalar field of density. That is, discrete measurements of the density of a quantity over a number of orthogonal dimensions.

That is, the input to the FFT is a set of measurements, each one answering the question "what is the density of the quantity at location ($$x,y,z, \ldots$$) (In fact, once you get familiar with this "density" concept, you can express all n-D FFTs as "densities").

How do we do this? What sort of signal looks like that? How do we collect it?

Imagine an $$M \times N \times L$$ array of pressure sensors that looks like a 3D led display. This mesh of pressure sensors divides space in discrete "boxes" and associates one instantaneous measurement of pressure with a specific point in time. If we acquire all $$M \times N \times L$$ we have captured one snapshot of the "pressure profile" of the sensor's region. If we could make a huge sensor like this and suspend it in the sky, we would be able to "witness" wave clouds. Wave clouds occur in the atmosphere and are therefore 3 dimensional. They may look "flat" to us from the ground but they have a 3D orientation in space.

I hope this example demonstrates this "density" concept. "Density" measures how much this quantity we are measuring over a set of orthogonal dimensions is "there or not". A high pressure measurement indicates "a lot of air" compressed around a particular point in space and vice versa for low pressure.

Let's see another example: 3D volumetric data like those collected by tomographic techniques such as X-Ray Tomography (CT).

In X-Ray tomography, the quantity is literally a "density" which corresponds to the absorption of X-Rays at a particular point in space. CT measurements are expressed in the Hounsfield scale which takes low values for material that is easily permeable by X-Rays (e.g. air at -1000) and high values for material that is NOT easily permeable by X-Rays (e.g. Steel at 20000).

OK, so to then make the connection that is required to answer the questions, we need one more observation: The fact that the n-dimensional FFT is equivalent to the 1D FFT successively applied to each orthogonal dimension.

For the 2D FFT, we first perform an FFT along the X direction. This gives us 1 complex number for each column which is describing the contribution of a sinusoid of some frequency $$m$$ to the variation of each column. This intermediate result however is saying nothing about the variation of the signal along the columns. To discover this, we then perform an FFT along the Y direction, over the already transformed data along the X dimension.

This completes the story because we now have a 2D set of complex measurements, each one telling us what is the contribution of a sinusoid of frequency $$m$$ (along the X dimension) and $$n$$ (along the Y dimension). This "contribution" is itself a complex number with real and imaginary components. BUT! each component is two dimensional. So, the output of the FFT of an image is "two images", one for the real component and one for the imaginary.

I am deliberately skipping a detail here, see further below.

Now, let's go to the 3D case. FFT along the X dimension, we now know the variation of the columns but not the rows. FFT along the Y dimension (the already FFT data along the X dimension), we now know the variation of the columns and the rows but still nothing for the third dimension. FFT along the Z dimension (the already FFT data along the Y dimension which was already the FFT of the X dimension) and now the story is complete.

We have a three dimensional array of complex numbers. That is we have one three dimensional array for the real part and another one for the imaginary part. Each point of this array tells us how much does a sinusoid of frequency $$m,n,l$$ contributes to the variation of the density of a quantity in 3D space.

• amplitude (globally the same for a given sinusoid?)

• I am not really sure what you mean with "globally" but amplitude is amplitude. At each $$m,n,l$$ cell of the array you have a complex number, take the amplitude of that and you find the total contribution of the $$m,n,l$$ sinusoid.
• wavelength (is it just one, or two -- one for each of the orthogonal directions?)

• OK, this is a bit "difficult". There are three sinusoids, along each of the dimensions. They are orthogonal to each other. But as far as the 3D scalar field is concerned, they are 1 "wave". These three numbers describe a spatial frequency within this volume. So, the wavelengths are three but they describe ONE 3d distribution of density.
• orientation (not just one angle as in 2D, but maybe two angles -- azimuthal and polar?)

• Again, orientation is orientation similar to how it is expressed in 2D and yes, you could describe it with two angles for a 3D field. (Also, see P.S.)
• phase shift (again just one, or would it be two for each of the orthogonal directions?)

• Phase shift is always with respect to the "measurement wave". So, when the 1D FFT measures the contribution of some sinusoid of frequency $$m$$, you measure phase shift with respect to that sinusoid's phase. Here is where it pays to think of the n-D wave as one wave. The phase still describes a phase shift with respect to the "measurement wave" and it is still expressed as the ratio of the $$\frac{Imag}{Real}$$ components.
• are there other sinusoid parameters unique to 3D FFT? does it depend on geometry?

• I am not really sure what you are asking here but I hope that the way I am explaining the n-D FFT here demonstrates that the FFT operates over sinusoids that are defined over n-D scalar fields. This is a generalisation of the plain simple sinusoid we know and everything else remains the same. There are no special parameters to the generalisation of the sinusoid.
• And how is the above different if you have a 3D scalar field vs. 3D vector field? I guess in the 3D vector field case, you just compute the FFT over each of the vector components separately?

• Indeed.
• If possible, a simple 3D FFT visualization example

• In this I have used the example of a carton of eggs to depict a 2D sinusoid in space. For the 3D version, the sinusoids look like the eggs that sit in the carton. But it is their transparency that changes sinusoidally because (remember), in the 3D and above cases we decompose the density of a quantity to the contribution of 3D sinusoids that describe components of that density along the three (or more) orthogonal dimensions. For another example, please see the first 15-20 seconds of this video.

Hope this helps.

P.S. The small detail that I omitted is to do with the reasons we apply fftshift() to the 2D FFT data. For ease of interpretation, we associate low frequencies with the center of an image. Similarly, for 3D and above, we would associate low frequencies with the center of the "cube". Which means that you would still have to do this fft-shift step. When the space is sampled equally to all dimensions, the result is a square (in 2D) or a cube (in 3D) or a hypercube (from 4D and above) and therefore a given spatial frequency implies the same for all n axes. So, some spatial frequency $$f$$ is at the "shell" of radius $$f$$ from the center of the hypercube. But then, you have to rotate around the shell to determine orientation.

• Density is just one physical application. It's not "fundamental" to the DFT. Higher dimensions introduce additional degrees of freedom and symmetries, with no unique physical meaning attached. Same for 1D and 2D. This needs clarifying, -1. Dec 30, 2022 at 8:09

Just to echo OverLordGoldDragons comment above, a 3D FFT (or any N-dimensional FFT) is not density. Density only describes a 3D FFT signal if you are using 3 spatial dimensions. You could have 2 spatial dimensions and 1 time dimenson and do a 3D FFT on it, which would include the time component in the frequencies returned by the FFT, instead of just looking at spatial components. There are any amount of units that could occupy any dimension of an FFT.

• 3 spatial dimensions is necessary but not sufficient. DFT inherits the signal's units (with added discrete units). My problem with A_A's answer is the suggestion that spatially 3D data is necessarily measured as density, which is obviously false. Feb 22, 2023 at 15:25

I'd like to emphasize my complaint about A_A's otherwise good answer: the DFT operates on points. It has no notion of "time", "density", or any other physical association. The DFT inherits the signal's units, in addition to discrete units (best but not necessarily expressed as cycles / sample). 3 spatial dimensions is necessary but not sufficient, as 3D data isn't necessarily measured as density - e.g. coordinates of a mountain.

"Spatial" is a term that can be used to describe any number of dimensions. In 1D, the spatial dimension is collapsed into a frequency statistic. In 2D, it's the same story but with an added degree of freedom, which adds associated symmetries (e.g. rotation). To "understand" 3D basis, one must understand the basis functions themselves - "density" is not only completely irrelevant but falsely suggestive that the DFT operates differently in higher dimensions, either in correlation or aggregation.

There's also density in 1D and 2D, and one could interpret DFT as computing a sort of density (e.g. PSD), but that's separate and applicable to all dimensions.

• For inclusion I'll mention cycles / sample is debated. Feb 22, 2023 at 15:47