diff --git a/Base/Math/FourierTransform.h b/Base/Math/FourierTransform.h index 2ea0be13504527b31e275d96e4d1e94b326d7a4d..0a944f4ca18689ec0b0e8abdd864a773d6a4631d 100644 --- a/Base/Math/FourierTransform.h +++ b/Base/Math/FourierTransform.h @@ -23,15 +23,6 @@ #include <vector> //! Fourier transform of vectors (in 1D or 2D) using Fast Fourier Transform (fftw package). -//! -//! Usage: -//! std::vector<double> signal, result; -//! FourierTransform ft; -//! ft.fft(signal, result) -//! -//! Given code rely on code from Jeremy Fix page, http://jeremy.fix.free.fr/spip.php?article15, -//! see also "Efficient convolution using the Fast Fourier Transform, Application in C++" -//! by Jeremy Fix, May 30, 2011 class FourierTransform { public: // 1D and 2D vectors @@ -42,29 +33,31 @@ public: FourierTransform(); - //! FT in 1D + // forward transform void rfft(const double1d_t& source, complex1d_t& result); - void irfft(const complex1d_t& source, double1d_t& result, int w_src); - void ramplitude(const double1d_t& source, double1d_t& result); - - //! Shift low frequency to the center of 1D FT array - static void fftshift(double1d_t& result); - static void fftshift(complex1d_t& result); + void rfft(const double2d_t& source, complex2d_t& result); - //! Shift low frequency to the edges of 1D FT array - static void ifftshift(double1d_t& result); - static void ifftshift(complex1d_t& result); + // forward transform with real-valued amplitudes in output + void ramplitude(const double1d_t& source, double1d_t& result); + void ramplitude(const double2d_t& source, double2d_t& result); - //! FT in 2D - void rfft(const double2d_t& source, complex2d_t& result); + // backward transform + void irfft(const complex1d_t& source, double1d_t& result, int w_src); void irfft(const complex2d_t& source, double2d_t& result, int w_real); - void ramplitude(const double2d_t& source, double2d_t& result); - //! Shift low frequency to the center of 2D FT array + // Frequency shifts are useful for providing different representations of spectrum: with lowest + // frequency at edges of array (default output of fft) or with lowest frequency in center of + // array + + // shift low frequency from corners to center + static void fftshift(double1d_t& result); + static void fftshift(complex1d_t& result); static void fftshift(double2d_t& result); static void fftshift(complex2d_t& result); - //! Shift low frequency to the corners of 2D FT array + // shift low frequency from center to corners + static void ifftshift(double1d_t& result); + static void ifftshift(complex1d_t& result); static void ifftshift(double2d_t& result); static void ifftshift(complex2d_t& result);