IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2004, 2:00:44 PM (22 years ago)
Author:
Paul Price
Message:

Major reworking of Fourier Transforms --- poor design previously.
Want to work with images, not some generic FFT type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psFFT.h

    r396 r613  
    1414 */
    1515
    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. */
     17psImage *
     18psImageFFT(const psImage *image         ///< Image to transform
     19    );
    2120
    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. */
     22psFloatArray *
     23psFloatArrayFFT(const psFloatArray *arr ///< Array to transform
     24    );
    2925
    30 /** Constructor */
    31 psFFT *
    32 psFFTAlloc(psImage *image               ///< Image to transform
    33            );
     26/** Inverse FFT an image. */
     27psImage *
     28psImageInverseFFT(const psImage *fftImage ///< FFT-ed image to inverse-transform
     29    );
    3430
    35 /** Constructor for 1D case */
    36 psFFT *
    37 psFFTAlloc1D(const psFloatArray *arr    ///< Array to transform
    38              );
     31/** Inverse FFT an array of complex floating-point numbers */
     32psComplexArray *
     33psComplexArrayInverseFFT(const psComplexArray *fftArray ///< FFT-ed array to inverse-transform
     34    );
    3935
    40 /** Destructor. Returns the data in the real space as an image. */
     36/** Calculate power spectrum of an image */
    4137psImage *
    42 psFFTFree(psImage *out,                 ///< Image to write the data to, or NULL
    43           psFFT *restrict fft           ///< FFT to destroy
    44           );
     38psImagePowerSpectrum(const psImage *image ///< Image to obtain power spectrum of
     39    );
    4540
    46 /** Forward FFT: from real to fourier space */
    47 psFFT *
    48 psFFTForward(psFFT *fft                 ///< FFT to apply (input and output)
    49              );
     41/** Calculate power spectrum of an array of floating-point numbers */
     42psFloatArray *
     43psFloatArrayPowerSpectrum(const psFloatArray *arr ///< Array to obtain power spectrum of
     44    );
    5045
    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. */
    5547
    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
     48/** Get the real part of an image */
     49psImage *
     50psImageReal(psImage *out,               ///< Image for output (or NULL)
     51            const psImage *in           ///< Image to get the real part of
    6052            );
    6153
    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 */
     55psFloatArray *
     56psComplexArrayReal(psFloatArray *out,   ///< Array for output (or NULL)
     57                   const psComplexArray *in ///< Array to get the real part of
     58    );
    6859
    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 */
     61psImage *
     62psImageConjugate(psImage *out,          ///< Image for output (or NULL)
     63                 const psImage *in      ///< Image to get the complex conjugate of
     64    );
    7665
    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 */
     67psComplexArray *
     68psComplexArrayConjugate(psComplexArray *out, ///< Array for output (or NULL)
     69                        const psComplexArray *in ///< Array to get the complex conjugate of
     70    );
    9971
    10072/* \} */ // End of MathGroup Functions
Note: See TracChangeset for help on using the changeset viewer.