Regular Discrete Fourier Transform (DFT)

imglib2
imagej
fft
imagej2
fourier

#1

Hi it’s me again,

how can I perform just a regular FFT? I’m used to know that the FFT has the same size as the input, so no need for extras as padding, offsetting and and shrinking (only showing the non-redundant-half). My last info is, that the imglib FFT is actually a Hartley Transform. Let’s say I just want the regular DFT as Matlab outputs. Any ideas? I don’t care about performance right now, but I do care for simplicity. Thanks!

Edit (what I have):

final Img floatImg = opService.convert().float32((IterableInterval)E0);

ImgFactory fftImgFactory = null;
fftImgFactory = floatImg.factory().imgFactory(new ComplexFloatType());
Img fft = FFT.realToComplex(floatImg, fftImgFactory);

uiService.show(floatImg);
ImageJFunctions.show(fft);

Now I get the transform and can show it or do something with it. But I do not even understand the output. Call me stupid, I’m fine with that. I prepared another complex valued image (with same dimensions as the original input) by myself in order to multiply it with the FFT. But the original dimensions were 2048x2048. With the code above I get an FFT-Image of 1041x2520. I really do not have time to investigate this but I promise I’m done flooding this forum with annoying questions afterwards.


#2

I really do not have time to investigate this but I promise I’m done flooding this forum with annoying questions afterwards.

Interesting!

If I were you I would do it the ImagJ-1 way as described before in your other thread.

AFAIK, with Fiji and Imagej-2 there are three common ways to get something like the DFT of images:

  1. The classic ImageJ way via the Hartley-transformation can be regarded to come close to the classic FFT
  2. The sometimes faster and “support size”-independent ImageJ-2 way which should not be called FFT.
  3. Then there is the really basic and classic FFT implementation as a plugin called “FFTJ”.

Try to start step by step via the GUI, then proceed to a macro solution and if you are happy, start coding the ImageJ-1 way. That’s my advice.

Can’t help you with ImageJ-2.

Good luck

Herbie


Is it a bug or just me?