Changeset 314 for trunk/archive/pslib/include/psFFT.h
- Timestamp:
- Mar 29, 2004, 7:40:01 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psFFT.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psFFT.h
r257 r314 1 1 #if !defined(PS_FFT_H) 2 2 #define PS_FFT_H 3 4 #include <fftw3.h> 3 5 4 6 /** \file psFFT.h … … 12 14 */ 13 15 14 /** Return Fourier Transform of an array */ 15 psComplexArray * 16 psRealFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL 17 const psFloatArray *restrict myArray //!< Input array 16 /** Details on FFT implementation (private). Example shown is for FFTW */ 17 typedef struct { 18 fftw_plan plan; //!< FFTW plan on how to do the FFT 19 char *filename; //!< File name for FFTW plan 20 } p_psFFTDetails; 21 22 /** Fast Fourier Transform */ 23 typedef struct { 24 p_psFFTDetails *details; //!< Details on FFT implementation (private) 25 int nx, ny; //!< Size in x and y 26 float **real; //!< Data in real space 27 void *fourier; //!< Data in fourier space; implementation dependent 28 } psFFT; 29 30 /** Constructor */ 31 psFFT * 32 psFFTAlloc(psImage *image //!< Image to transform 33 ); 34 35 /** Constructor for 1D case */ 36 psFFT * 37 psFFTAlloc1D(const psFloatArray *arr //!< Array to transform 38 ); 39 40 /** Destructor. Returns the data in the real space as an image. */ 41 psImage * 42 psFFTFree(psImage *out, //!< Image to write the data to, or NULL 43 psFFT *restrict fft //!< FFT to destroy 18 44 ); 19 45 20 /** Return [inverse?] Fourier Transform of a complex array. May NOT be done in-place (restrict-ed) */ 21 psComplexArray * 22 psComplexFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL 23 const psComplexArray *restrict myArray, //!< Input array 24 int sign //!< +1 or -1 to indicate direction of FT 25 ); 46 /** Forward FFT: from real to fourier space */ 47 psFFT * 48 psFFTForwardTransform(psFFT *fft //!< FFT to apply (input and output) 49 ); 26 50 27 /** Return Power spectrum of a array */ 28 psFloatArray * 29 psPowerSpec(psFloatArray *restrict out, //!< Output array to be returned 30 const psFloatArray *restrict myArray //!< Input array 51 /** Reverse FFT: from fourier to real space */ 52 psFFT * 53 psFFTReverseTransform(psFFT *fft //!< FFT to apply (input and output) 54 ); 55 56 /** Apply filter function in fourier space */ 57 psFFT * 58 psFFTFilter(psFFT *fft, //!< FFT to use (input and output) 59 float (*filterFunc)(int kx, int ky) //!< External filter function 31 60 ); 61 62 /** Apply complex filter function */ 63 psFFT * 64 psFFTFilterComplex(psFFT *fft, //!< FFT to use (input and output) 65 float (*realFilterFunc)(int kx, int ky), //!< External filter function, real part 66 float (*imagFilterFunc)(int kx, int ky) //!< External filter function, imaginary part 67 ); 68 69 /** Calculate cross-correlation function */ 70 psFFT * 71 psFFTCrossCorrelate(psFFT *out //!< Output FFT (or NULL) 72 const psFFT *fft1, const psFFT *fft2 //!< FFTs to use in cross-correlation 73 ); 74 75 /** Calculate power spectrum */ 76 psFFT * 77 psFFTPowerSpec(psFFT *fft //!< FFT to use (input and output) 78 ); 79 80 /** Multiply two Fourier transforms, as for convolution */ 81 psFFT * 82 psFFTMultiplyFT(psFFT *out, //!< Output FFT (or NULL) 83 const psFFT *fft1, const psFFT *fft2 //!< FFTs to multiply 84 ); 85 86 /* Convert the real data in the FFT struct to an image again */ 87 psImage * 88 psFFTGetImage(psImage *out, //!< Image to write to (or NULL) 89 const psFFT *fft //!< FFT to get image from 90 ); 91 92 /** Convert the Fourier transform data in the FFT struct to an image of complex numbers */ 93 psImage * 94 psFFTGetFT(psImage *out, //!< Image to write to (or NULL) 95 const psFFT *fft //!< FFT to get Fourier transform from 96 ); 32 97 33 98 /* \} */ // End of MathGroup Functions 34 99 35 100 #endif 101 102
Note:
See TracChangeset
for help on using the changeset viewer.
