My Project
fft1d_r2c.hh
Go to the documentation of this file.
1/* -*- mia-c++ -*-
2 *
3 * This file is part of MIA - a toolbox for medical image analysis
4 * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
5 *
6 * MIA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with MIA; if not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#ifndef mia_core_fft1d_r2c_hh
22#define mia_core_fft1d_r2c_hh
23
24#include <mia/core/defines.hh>
25#include <vector>
26#include <complex>
27#include <fftw3.h>
28
30
42{
43public:
44 struct Complex : public std::complex<float> {
45 Complex(): std::complex<float>(0.0, 0.0) {}
46 Complex(const std::complex<float>& other): std::complex<float>(other) {}
47#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
48 Complex(fftwf_complex& v):
49 std::complex<float>(v)
50 {
51 }
52#else
53 Complex(fftwf_complex& v):
54 std::complex<float>(v[0], v[1])
55 {
56 }
57#endif
58 };
59
61 typedef float Real;
62
68 CFFT1D_R2C(size_t n);
70
76 std::vector<Complex> forward(const std::vector<Real>& data) const;
77
83 std::vector<Real> backward(const std::vector<Complex>& data) const;
84
93 void forward(std::vector<Real>::const_iterator in_begin,
94 std::vector<Real>::const_iterator in_end,
95 std::vector<Complex>::iterator out_begin) const;
96
97
107 void backward(std::vector<Complex>::const_iterator in_begin,
108 std::vector<Complex>::const_iterator in_end,
109 std::vector<Real>::iterator out_begin) const;
110
112 size_t out_size() const;
113
114private:
115 struct CFFT1D_R2CImpl *impl;
116
117};
118
120
121#endif
a class to real-to-complex 1D FFTs
Definition fft1d_r2c.hh:42
float Real
A typedef that makes switching between single precicion and double precicion easier.
Definition fft1d_r2c.hh:61
std::vector< Real > backward(const std::vector< Complex > &data) const
void backward(std::vector< Complex >::const_iterator in_begin, std::vector< Complex >::const_iterator in_end, std::vector< Real >::iterator out_begin) const
void forward(std::vector< Real >::const_iterator in_begin, std::vector< Real >::const_iterator in_end, std::vector< Complex >::iterator out_begin) const
size_t out_size() const
CFFT1D_R2C(size_t n)
std::vector< Complex > forward(const std::vector< Real > &data) const
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
Complex(fftwf_complex &v)
Definition fft1d_r2c.hh:53
Complex(const std::complex< float > &other)
Definition fft1d_r2c.hh:46