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 public:
43  struct Complex : public std::complex<float> {
44  Complex():std::complex<float>(0.0, 0.0){}
45  Complex(const std::complex<float>& other):std::complex<float>(other){}
46 #if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
47  Complex(fftwf_complex& v):
48  std::complex<float>(v)
49  {
50  }
51 #else
52  Complex(fftwf_complex& v):
53  std::complex<float>(v[0], v[1])
54  {
55  }
56 #endif
57  };
58 
60  typedef float Real;
61 
67  CFFT1D_R2C(size_t n);
68  ~CFFT1D_R2C();
69 
75  std::vector<Complex> forward(const std::vector<Real>& data) const;
76 
82  std::vector<Real> backward(const std::vector<Complex>& data) const;
83 
92  void forward(std::vector<Real>::const_iterator in_begin,
93  std::vector<Real>::const_iterator in_end,
94  std::vector<Complex>::iterator out_begin) const;
95 
96 
106  void backward(std::vector<Complex>::const_iterator in_begin,
107  std::vector<Complex>::const_iterator in_end,
108  std::vector<Real>::iterator out_begin) const;
109 
111  size_t out_size() const;
112 
113  private:
114  struct CFFT1D_R2CImpl *impl;
115 
116 };
117 
119 
120 #endif
float Real
A typedef that makes switching between single precicion and double precicion easier.
Definition: fft1d_r2c.hh:60
Complex(fftwf_complex &v)
Definition: fft1d_r2c.hh:52
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
Complex(const std::complex< float > &other)
Definition: fft1d_r2c.hh:45
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition: defines.hh:101
a class to real-to-complex 1D FFTs
Definition: fft1d_r2c.hh:41
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36