Changeset 613 for trunk/archive/pslib/include/psFFT.h
- Timestamp:
- May 7, 2004, 2:00:44 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psFFT.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psFFT.h
r396 r613 14 14 */ 15 15 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; 16 /** Forward FFT an image. Returns a complex float image. */ 17 psImage * 18 psImageFFT(const psImage *image ///< Image to transform 19 ); 21 20 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: a 2D array using the [nx*y + x] stuff 27 void *fourier; ///< Data in fourier space; implementation dependent 28 } psFFT; 21 /** Forward FFT an array of floating-point numbers. */ 22 psFloatArray * 23 psFloatArrayFFT(const psFloatArray *arr ///< Array to transform 24 ); 29 25 30 /** Constructor*/31 ps FFT*32 ps FFTAlloc(psImage *image ///< Image totransform33 );26 /** Inverse FFT an image. */ 27 psImage * 28 psImageInverseFFT(const psImage *fftImage ///< FFT-ed image to inverse-transform 29 ); 34 30 35 /** Constructor for 1D case*/36 ps FFT*37 ps FFTAlloc1D(const psFloatArray *arr ///< Array totransform38 );31 /** Inverse FFT an array of complex floating-point numbers */ 32 psComplexArray * 33 psComplexArrayInverseFFT(const psComplexArray *fftArray ///< FFT-ed array to inverse-transform 34 ); 39 35 40 /** Destructor. Returns the data in the real space as an image.*/36 /** Calculate power spectrum of an image */ 41 37 psImage * 42 psFFTFree(psImage *out, ///< Image to write the data to, or NULL 43 psFFT *restrict fft ///< FFT to destroy 44 ); 38 psImagePowerSpectrum(const psImage *image ///< Image to obtain power spectrum of 39 ); 45 40 46 /** Forward FFT: from real to fourier space*/47 psF FT*48 psF FTForward(psFFT *fft ///< FFT to apply (input and output)49 );41 /** Calculate power spectrum of an array of floating-point numbers */ 42 psFloatArray * 43 psFloatArrayPowerSpectrum(const psFloatArray *arr ///< Array to obtain power spectrum of 44 ); 50 45 51 /** Reverse FFT: from fourier to real space */ 52 psFFT * 53 psFFTReverse(psFFT *fft ///< FFT to apply (input and output) 54 ); 46 /* The below functions are provided to allow cross-correlations etc. */ 55 47 56 /** Apply filter function in fourier space */57 ps FFT*58 ps FFTFilter(psFFT *fft, ///< FFT to use (input and output)59 float (*filterFunc)(int kx, int ky) ///< External filter function48 /** Get the real part of an image */ 49 psImage * 50 psImageReal(psImage *out, ///< Image for output (or NULL) 51 const psImage *in ///< Image to get the real part of 60 52 ); 61 53 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 ); 54 /** Get the real part of an array of complex floating-point numbers */ 55 psFloatArray * 56 psComplexArrayReal(psFloatArray *out, ///< Array for output (or NULL) 57 const psComplexArray *in ///< Array to get the real part of 58 ); 68 59 69 /** Calculate FFT of the cross-correlation. Multiplication of the first FFT with the complex conjugate of 70 * the second. 71 */ 72 psFFT * 73 psFFTCrossCorrelate(psFFT *out, ///< Output FFT (or NULL) 74 const psFFT *fft1, const psFFT *fft2 ///< FFTs to use in cross-correlation 75 ); 60 /** Get the complex conjugate of an image */ 61 psImage * 62 psImageConjugate(psImage *out, ///< Image for output (or NULL) 63 const psImage *in ///< Image to get the complex conjugate of 64 ); 76 65 77 /** Calculate FFT of the convolution. Straight multiplication of the FFTs */ 78 psFFT * 79 psFFTConvolve(psFFT *out, ///< Output FFT (or NULL) 80 const psFFT *fft1, const psFFT *fft2 ///< FFTs to multiply 81 ); 82 83 /** Calculate power spectrum */ 84 psFloatArray * 85 psFFTPowerSpec(psFFT *fft ///< FFT to use (input and output) 86 ); 87 88 /* Convert the real data in the FFT struct to an image again */ 89 psImage * 90 psFFTGetImage(psImage *out, ///< Image to write to (or NULL) 91 const psFFT *fft ///< FFT to get image from 92 ); 93 94 /** Convert the Fourier transform data in the FFT struct to an image of complex numbers */ 95 psImage * 96 psFFTGetFT(psImage *out, ///< Image to write to (or NULL) 97 const psFFT *fft ///< FFT to get Fourier transform from 98 ); 66 /** Get the complex conjugate of an array of complex floating-point numbers */ 67 psComplexArray * 68 psComplexArrayConjugate(psComplexArray *out, ///< Array for output (or NULL) 69 const psComplexArray *in ///< Array to get the complex conjugate of 70 ); 99 71 100 72 /* \} */ // End of MathGroup Functions
Note:
See TracChangeset
for help on using the changeset viewer.
