Power spectrum plots from ImageJ?

Greetings! The FFT process command in ImageJ provides the power spectrum of an image as another image. The usefulness of this is clear from the FFT Measurements and Filtering tutorials, but what about a plot of the image power spectral density vs. frequency or wave number? Such power spectrum plots are ubiquitous in science, allowing one to identify spectrum peaks associated with various phenomena. This would be a powerful way to display the spectral content of a stack of images depicting something in motion. I’ve looked, but not found an ImageJ plugin that does this. Please excuse me if I’ve overlooked it. On occasion I’ve exported raw FFT plot data into Excel to do this, but that is clumsy. If someone has already written a macro for power spectrum plots, it would save time. Thanks!

1 Like

Since 31 people read this in a week, it seems that there is some interest in doing this, so here is what I figured out on my own: My original question was ill-posed, since a time sequence of 2D images contains enough information to construct power spectrum plots for every pixel. Suppose that we choose a certain pixel of interest in order to to simplify matters. In ImageJ, load a time sequence of images as a stack, or else import an avi video as a stack of images. Choose a pixel location of interest and mark it with the single-point tool. Now with image/stacks/plot z-axis profile you will get a plot of the chosen pixel intensity vs. time across the entire stack. Since ImageJ lacks the ability to do periodograms, now save the data string from this plot and move to, for example, Matlab, where the periodogram function will perform an FFT of the data and produce a power spectral density plot. (See the Matlab signal processing toolbox/statistical signal processing/periodogram.) If you have several locations of interest in your image stack, you can get power spectra for each of them this way.

1 Like

@gsettles, the following discussion is probably relevant:

AFAIK the original poster @Christian_Tischer ended up not using FIJI but as periodigram function in scipy, which is very similar to the Matlab periodigram function you mentioned.

1 Like

Dear @gsettles,

Indeed it would be nice to get the Power Spectrum in something simple like an ImageJ Macro!

And it turns out there actually is something there!

If you take this macro code, it should do what you want. It was taken from https://imagej.net/ij/developer/macro/functions.html#Array.fourier

windowType="None"; //None, Hamming, Hann or Flattop

getSelectionCoordinates( x, y );
run( "Plot Z-axis Profile" );
Plot.getValues( xpoints, ypoints );
 y = Array.fourier( ypoints, windowType );

Plot.create("Fourier amplitudes: "+windowType, "frequency bin", "amplitude", xpoints, y);

I wish I could @ the person who did this, but did not find a name in the documentation. @Wayne, is it you?


It was Michael Schmid.


To round out this topic, let me say that I heard from Prof. H. Glünder, who pointed out to me the Array.fourier function and also an ImageJ plugin he wrote called nr realft (for numerical recipes, real Fourier transform). I find nr realft very handy because it accepts as input a line ROI in an image and computes the corresponding 1D power spectrum. However, nr realft is not listed in the usual listings of ImageJ plugins. If you want it, here is the link:

I thank Prof. Glünder and those who contributed comments above, and I hope that now anyone who wants to extract 1D power spectra from image sequences in ImageJ will find the tools she needs to do so.
Gary Settles