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 public:
53  typedef fft2d_kernel_data plugin_data;
55  typedef kernel_plugin_type plugin_type;
56 
57  CFFT2DKernel();
58 
59  virtual ~CFFT2DKernel();
60 
66  void apply() const;
67 
68 
73  float *prepare(const C2DBounds& size);
74 
75 private:
76  /*
77  free all the FFT structures
78  */
79  void tear_down();
80 
81  virtual void do_apply(const C2DBounds& m_size, size_t m_realsize_x,
82  fftwf_complex *m_cbuffer) const = 0;
83 
84  C2DBounds m_size;
85  fftwf_complex *m_cbuffer;
86  float *m_fbuffer;
87  float m_scale;
88  fftwf_plan m_forward_plan;
89  fftwf_plan m_backward_plan;
90 
91  size_t m_realsize_x;
92 };
93 
94 typedef std::shared_ptr<CFFT2DKernel > PFFT2DKernel;
95 typedef TFactory<CFFT2DKernel> CFFT2DKernelPlugin;
96 typedef THandlerSingleton<TFactoryPluginHandler<CFFT2DKernelPlugin> > CFFT2DKernelPluginHandler;
97 
99 
101 
102 #endif
103 
the singleton that a plug-in handler really is
Definition: handler.hh:157
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition: defines.hh:33
static const char * data_descr
Definition: fftkernel.hh:36
#define EXPORT_2D
Definition: defines2d.hh:37
This is tha base of all plugins that create "things", like filters, cost functions time step operator...
Definition: factory.hh:49
The base class for all plug-in created object.
Definition: product_base.hh:40
#define NS_MIA_END
conveniance define to end the mia namespace
Definition: defines.hh:36