Quick Note: I don't believe this is a subjective question... however if it is I will gladly modify to be more objective

In ImageJ, if I take the FFT of an image, how can I save this new frequency domain image? The goal being that I would like to be able to open it up and take the IFFT.

When I try this, imageJ says you need to have a frequency domain image. This leaves me thinking that whatever information it has about the frequency domain is lost once I save.

My end goal is to take images that I have taken the FFT of from a python script that I am debugging and load them up in imageJ and take the IFFT.

  • $\begingroup$ What did you save? Did you save both the real and imaginary components of the complex 2D FFT? $\endgroup$ – hotpaw2 Nov 1 '16 at 18:07
  • $\begingroup$ From imageJ I must only be saving the real components. I have not found... how to save the imaginary components. I wonder if it is possible to access this information with imageJ ? $\endgroup$ – Kyle Swanson Nov 1 '16 at 18:26

A real image generally is a multichannel (often RGB) stack of real, or integer data. An standard FFT converts each channel to a complex domain image. Which is often not supported in standard formats.

Although complex data types are supported in some language, I do not know of fully standard complex storage file formats. Which would be nice... Let us start with some basics...

The most simple option is to store them as two different images (for the real/imaginary parts, or amplitude/phase parts), or in two different channels. It probably requires some adjustment in amplitudes, and thus a little additional information.

However, some "niche" formats could be reused. I am thinking about MRI data with a complex appearance in the $k$-space (see Magnitude, real and phase images). The full datasets provided here proposes a two-part format for such complex data, along with Matlab code, which probably could be translated for ImageJ. Description:

The .cfl raw data file is a binary file containing a single contiguous block of array data of dimensions described in the header file. The raw data file is of type complex float (i.e. 32-bit real + 32-bit imaginary), hence the extension .cfl.

Finally, the ISMRM Raw Data Format (ISMRMRD) supports complex data.

  • 1
    $\begingroup$ I was afraid of something like that... I find it interesting that there is not a complex storage format. $\endgroup$ – Kyle Swanson Nov 1 '16 at 18:27

A trick would be to use the TIFF format which supports many channels. For each channel in your original image create 2 channels, one for the magnitude and the other for the phase.

TIFF supports 32 bit hence data will be well preserved.

  • $\begingroup$ Can you provide an example? $\endgroup$ – Antoni Parellada Sep 20 '19 at 13:37
  • $\begingroup$ I will try later. If I remember to do it. The trick is to predefine the scales (Dynamic Range). $\endgroup$ – Royi Sep 20 '19 at 18:01

This is not a knowledgeable answer, but more of a comment including one possible "how-to" tip with a screen capture of what was done. The FFT was saved as a TIFF; reopened; and ultimately an inverse FFT returned the original image (although not quite - it looks smaller, and it contains two images that I don't know how to interpret - the second image is not shown, but it can be displayed using the ImageJ output windows by sliding the bar at the bottom to the right):

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.