My Project
fftkernel.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_2d_fftkernel_hh
22 #define mia_2d_fftkernel_hh
23 
24 #include <complex>
25 #include <fftw3.h>
26 
27 #include <mia/core/defines.hh>
28 #include <mia/core/factory.hh>
30 #include <mia/2d/defines2d.hh>
31 #include <mia/2d/vector.hh>
32 
34 
36  static const char *data_descr;
37 };
38 
50 class EXPORT_2D CFFT2DKernel : public CProductBase
51 {
52 public:
54  typedef fft2d_kernel_data plugin_data;
56  typedef kernel_plugin_type plugin_type;
57 
58  CFFT2DKernel();
59 
60  virtual ~CFFT2DKernel();
61 
67  void apply() const;
68 
69 
74  float *prepare(const C2DBounds& size);
75 
76 private:
77  /*
78  free all the FFT structures
79  */
80  void tear_down();
81 
82  virtual void do_apply(const C2DBounds& m_size, size_t m_realsize_x,
83  fftwf_complex *m_cbuffer) const = 0;
84 
85  C2DBounds m_size;
86  fftwf_complex *m_cbuffer;
87  float *m_fbuffer;
88  float m_scale;
89  fftwf_plan m_forward_plan;
90  fftwf_plan m_backward_plan;
91 
92  size_t m_realsize_x;
93 };
94 
95 typedef std::shared_ptr<CFFT2DKernel > PFFT2DKernel;
96 typedef TFactory<CFFT2DKernel> CFFT2DKernelPlugin;
97 typedef THandlerSingleton<TFactoryPluginHandler<CFFT2DKernelPlugin>> CFFT2DKernelPluginHandler;
98 
100 
102 
103 #endif
104 
The base class for all plug-in created object.
Definition: product_base.hh:41
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:51
the singleton that a plug-in handler really is
Definition: handler.hh:159
#define EXPORT_2D
Definition: defines2d.hh:37
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36
static const char * data_descr
Definition: fftkernel.hh:36