fft1d_r2c.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_core_fft1d_r2c_hh
#define mia_core_fft1d_r2c_hh
#include <mia/core/defines.hh>
#include <vector>
#include <complex>
#include <fftw3.h>
NS_MIA_BEGIN
class EXPORT_CORE CFFT1D_R2C
{
public:
struct Complex : public std::complex<float> {
Complex(): std::complex<float>(0.0, 0.0) {}
Complex(const std::complex<float>& other): std::complex<float>(other) {}
#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
Complex(fftwf_complex& v):
std::complex<float>(v)
{
}
#else
Complex(fftwf_complex& v):
std::complex<float>(v[0], v[1])
{
}
#endif
};
typedef float Real;
CFFT1D_R2C(size_t n);
~CFFT1D_R2C();
std::vector<Complex> forward(const std::vector<Real>& data) const;
std::vector<Real> backward(const std::vector<Complex>& data) const;
void forward(std::vector<Real>::const_iterator in_begin,
std::vector<Real>::const_iterator in_end,
std::vector<Complex>::iterator out_begin) const;
void backward(std::vector<Complex>::const_iterator in_begin,
std::vector<Complex>::const_iterator in_end,
std::vector<Real>::iterator out_begin) const;
size_t out_size() const;
private:
struct CFFT1D_R2CImpl *impl;
};
NS_MIA_END
#endif
CFFT1D_R2C::Real
float Real
A typedef that makes switching between single precicion and double precicion easier.
Definition fft1d_r2c.hh:61
CFFT1D_R2C::~CFFT1D_R2C
~CFFT1D_R2C()
CFFT1D_R2C::backward
std::vector< Real > backward(const std::vector< Complex > &data) const
CFFT1D_R2C::backward
void backward(std::vector< Complex >::const_iterator in_begin, std::vector< Complex >::const_iterator in_end, std::vector< Real >::iterator out_begin) const
CFFT1D_R2C::forward
void forward(std::vector< Real >::const_iterator in_begin, std::vector< Real >::const_iterator in_end, std::vector< Complex >::iterator out_begin) const
CFFT1D_R2C::out_size
size_t out_size() const
CFFT1D_R2C::CFFT1D_R2C
CFFT1D_R2C(size_t n)
CFFT1D_R2C::forward
std::vector< Complex > forward(const std::vector< Real > &data) const
defines.hh
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
std
Definition gsl_iterator.hh:324
CFFT1D_R2C::Complex
Definition fft1d_r2c.hh:44
CFFT1D_R2C::Complex::Complex
Complex()
Definition fft1d_r2c.hh:45
CFFT1D_R2C::Complex::Complex
Complex(fftwf_complex &v)
Definition fft1d_r2c.hh:53
CFFT1D_R2C::Complex::Complex
Complex(const std::complex< float > &other)
Definition fft1d_r2c.hh:46