Index: trunk/archive/pslib/include/psFFT.h
===================================================================
--- trunk/archive/pslib/include/psFFT.h	(revision 257)
+++ trunk/archive/pslib/include/psFFT.h	(revision 314)
@@ -1,4 +1,6 @@
 #if !defined(PS_FFT_H)
 #define PS_FFT_H
+
+#include <fftw3.h>
 
 /** \file psFFT.h
@@ -12,24 +14,89 @@
  */
 
-/** Return Fourier Transform of an array */
-psComplexArray *
-psRealFFT(psComplexArray *restrict out,	//!< Output array to be returned; may be NULL
-	  const psFloatArray *restrict myArray //!< Input array
+/** Details on FFT implementation (private).  Example shown is for FFTW */
+typedef struct {
+    fftw_plan plan;			//!< FFTW plan on how to do the FFT
+    char *filename;			//!< File name for FFTW plan
+} p_psFFTDetails;
+
+/** Fast Fourier Transform */
+typedef struct {
+    p_psFFTDetails *details;		//!< Details on FFT implementation (private)
+    int nx, ny;				//!< Size in x and y
+    float **real;			//!< Data in real space
+    void *fourier;			//!< Data in fourier space; implementation dependent
+} psFFT;
+
+/** Constructor */
+psFFT *
+psFFTAlloc(psImage *image		//!< Image to transform
+	   );
+
+/** Constructor for 1D case */
+psFFT *
+psFFTAlloc1D(const psFloatArray *arr	//!< Array to transform
+	     );
+
+/** Destructor. Returns the data in the real space as an image. */
+psImage *
+psFFTFree(psImage *out,			//!< Image to write the data to, or NULL
+	  psFFT *restrict fft		//!< FFT to destroy
 	  );
 
-/** Return [inverse?] Fourier Transform of a complex array.  May NOT be done in-place (restrict-ed) */
-psComplexArray *
-psComplexFFT(psComplexArray *restrict out, //!< Output array to be returned; may be NULL
-	     const psComplexArray *restrict myArray, //!< Input array
-	     int sign			//!< +1 or -1 to indicate direction of FT
-	     );
+/** Forward FFT: from real to fourier space */
+psFFT *
+psFFTForwardTransform(psFFT *fft	//!< FFT to apply (input and output)
+		      );
 
-/** Return Power spectrum of a array */
-psFloatArray *
-psPowerSpec(psFloatArray *restrict out,	//!< Output array to be returned
-	    const psFloatArray *restrict myArray //!< Input array
+/** Reverse FFT: from fourier to real space */
+psFFT *
+psFFTReverseTransform(psFFT *fft	//!< FFT to apply (input and output)
+		      );
+
+/** Apply filter function in fourier space */
+psFFT *
+psFFTFilter(psFFT *fft,			//!< FFT to use (input and output)
+	    float (*filterFunc)(int kx, int ky)	//!< External filter function
 	    );
+
+/** Apply complex filter function */
+psFFT *
+psFFTFilterComplex(psFFT *fft,		//!< FFT to use (input and output)
+		   float (*realFilterFunc)(int kx, int ky), //!< External filter function, real part
+		   float (*imagFilterFunc)(int kx, int ky) //!< External filter function, imaginary part
+		   );
+
+/** Calculate cross-correlation function */
+psFFT *
+psFFTCrossCorrelate(psFFT *out		//!< Output FFT (or NULL)
+		    const psFFT *fft1, const psFFT *fft2 //!< FFTs to use in cross-correlation
+		    );
+
+/** Calculate power spectrum */
+psFFT *
+psFFTPowerSpec(psFFT *fft		//!< FFT to use (input and output)
+	       );
+
+/** Multiply two Fourier transforms, as for convolution */
+psFFT *
+psFFTMultiplyFT(psFFT *out,		//!< Output FFT (or NULL)
+		const psFFT *fft1, const psFFT *fft2 //!< FFTs to multiply
+		);
+
+/* Convert the real data in the FFT struct to an image again */
+psImage *
+psFFTGetImage(psImage *out,		//!< Image to write to (or NULL)
+	      const psFFT *fft		//!< FFT to get image from
+	      );
+
+/** Convert the Fourier transform data in the FFT struct to an image of complex numbers */
+psImage *
+psFFTGetFT(psImage *out,		//!< Image to write to (or NULL)
+	   const psFFT *fft		//!< FFT to get Fourier transform from
+	   );
 
 /* \} */ // End of MathGroup Functions
 
 #endif
+
+
