/* @file  psImageFFT.h
 * @brief Contains FFT transform related functions for psImage
 *
 * @author Robert DeSonia, MHPCC
 *
 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
 * @date $Date: 2007-01-23 22:47:22 $
 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */

#ifndef PS_IMAGE_FFT_H
#define PS_IMAGE_FFT_H

#include "psImage.h"
#include "psVectorFFT.h"               // for psFFTFlags

/// @addtogroup MathOps Mathematical Operations
/// @{

/** Forward and reverse FFT calculations.
 *
 *  This takes as input the image of interest (in) and the direction
 *  (direction), which is specified by an enumerated type psFftDirection.
 *  The input image may be of type psF32 or psC32, the result is always
 *  psC32. If the input vector is psF32, the direction must be forward.
 *
 *  @return psImage* the FFT transformation result
 */
psImage* psImageFFT(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* image,              ///< the psImage to apply transform to
    psFFTFlags direction               ///< the direction of the transform
);

/** extract the real portion of a complex image
 *
 *  @return psImage*   real portion of the input image.
 */
psImage* psImageReal(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* in                  ///< the psImage to extract real portion from
);

/** extract the imaginary portion of a complex image
 *
 *  @return psImage*   imaginary portion of the input image.
 */
psImage* psImageImaginary(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* in                  ///< the psImage to extract imaginary portion from
);

/** creates a complex image from separate real and imaginary plane images
 *
 *  @return psImage*   resulting complex image
 */
psImage* psImageComplex(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* real,               ///< the real plane image
    const psImage* imag                ///< the imaginary plane image
);

/** computes the complex conjugate of an image
 *
 *  @return psImage*   the complex conjugate of the 'in' image
 */
psImage* psImageConjugate(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* in                  ///< the psImage to compute conjugate of
);

/** computes the power spectrum of an image
 *
 *  @return psImage*   the power spectrum of the 'in' image
 */
psImage* psImagePowerSpectrum(
    psImage* out,                      ///< a psImage to recycle.  If NULL, a new psImage is made.
    const psImage* in                  ///< the psImage to power spectrum of
);

/// @}
#endif // #ifndef PS_IMAGE_FFT_H
