Rotation of the FFT of a complex wave coming from MatrixOP

Hi. The two line of code give the same result, but matrixop is much faster:
FFT/Z/OUT=3/DEST=Image_FFT Image
MatrixOP/O Image_FFT=FFT(Image,3)

Is there any way I could tune the MatrixOP command to rotate the FFT and give a result similar to
FFT/OUT=3/DEST=Image_FFT Image

(lacks the /Z).
First, FFT with /out=3 gives you the magnitude so you should start with
MatrixOP/O aa=mag(fft(image,opt))

if you use opt=2 in the above you should get the same results.

A.G.
WaveMetrics, Inc.
I probably did not explained it well. When I use FFT/OUT=3 I get the FFT centered on the Y axis. This does not happen when using /Z or MatrixOP. What I would like is to use the matrixop and get a similar result as the FFT without the /Z.

The help for FFT states:
/Z Disables rotation of the FFT of a complex wave. Igor normally rotates the FFT result (which is also complex) by N/2 so that x=0 is at the center point (N/2). When /Z is specified, Igor does not perform this rotation and leaves x=0 at the first point (0).
IgorExchange.jpg
alchymoon wrote:
I probably did not explained it well. When I use FFT/OUT=3 I get the FFT centered on the Y axis. This does not happen when using /Z or MatrixOP. What I would like is to use the matrixop and get a similar result as the FFT without the /Z.


I'm not sure which option you want so is my example:
make/n=(100,100) ddd=gauss(x,50,10,y,50,20)
matrixop/o aa=mag(fft(ddd,2))
newimage aa
matrixop/o aa=mag(fft(ddd,1))
// compare with FFT:
FFT/out=3/dest=bb ddd
matrixop/o cc=sum(abs(bb-aa))
print cc[0]

// now try with /Z
matrixop/o aa=mag(fft(ddd,2))
FFT/z/out=3/dest=bb ddd
matrixop/o cc=sum(abs(bb-aa))
print cc[0]


... and you may also want to take a quick look at ImageTransform with the keyword swap.

I hope this helps,

A.G.
WaveMetrics, Inc.
Thanks. Also I've noticed that using MatrixOP/O Image_FFT=FFT(Image,6) and Image_FFT=abs(Image_FFT) gives the desired result. Unfortunatly, it turned to be slower than the regular FFT.
alchymoon wrote:
MatrixOP/O Image_FFT=FFT(Image,6) and Image_FFT=abs(Image_FFT) gives the desired result. Unfortunatly, it turned to be slower than the regular FFT.



1. note that the opt paramter is a binary flag.
2. If you are going to use MatrixOP, it is inefficient to split execution into multiple instructions as you have done above. Instead, combine into a single instruction:
MatrixOP/O out=mag(FFT(image,opt))

This saves you at least one allocation compared with two separate MatrixOP calls.

A.G.
WaveMetrics, Inc.