Orfeo Toolbox  3.16
itkFFTWCommon.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkFFTWCommon.h,v $
5  Language: C++
6  Date: $Date: 2008-12-21 19:13:11 $
7  Version: $Revision: 1.8 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkFFTWCommon_h
18 #define __itkFFTWCommon_h
19 
20 #if defined(USE_FFTWF) || defined(USE_FFTWD)
21 #include "fftw3.h"
22 #endif
23 
24 namespace itk
25 {
26 namespace fftw
27 {
32 template <typename TPixel>
33 class Proxy
34 {
35  // empty -- only double and float specializations work
36 protected:
37  Proxy() {};
38  ~Proxy() {};
39 };
40 
41 #if defined(USE_FFTWF)
42 
43 template <>
44 class Proxy<float>
45 {
46 public:
47  typedef float PixelType;
48  typedef fftwf_complex ComplexType;
49  typedef fftwf_plan PlanType;
50 
51  static PlanType Plan_dft_c2r_1d(int n,
52  ComplexType *in,
53  PixelType *out,
54  unsigned flags)
55  {
56  return fftwf_plan_dft_c2r_1d(n,in,out,flags);
57  }
58  static PlanType Plan_dft_c2r_2d(int nx,
59  int ny,
60  ComplexType *in,
61  PixelType *out,
62  unsigned flags)
63  {
64  return fftwf_plan_dft_c2r_2d(nx,ny,in,out,flags);
65  }
66  static PlanType Plan_dft_c2r_3d(int nx,
67  int ny,
68  int nz,
69  ComplexType *in,
70  PixelType *out,
71  unsigned flags)
72  {
73  return fftwf_plan_dft_c2r_3d(nx,ny,nz,in,out,flags);
74  }
75  static PlanType Plan_dft_c2r(int rank,
76  const int *n,
77  ComplexType *in,
78  PixelType *out,
79  unsigned flags)
80  {
81  return fftwf_plan_dft_c2r(rank,n,in,out,flags);
82  }
83 
84  static PlanType Plan_dft_r2c_1d(int n,
85  PixelType *in,
86  ComplexType *out,
87  unsigned flags)
88  {
89  return fftwf_plan_dft_r2c_1d(n,in,out,flags);
90  }
91  static PlanType Plan_dft_r2c_2d(int nx,
92  int ny,
93  PixelType *in,
94  ComplexType *out,
95  unsigned flags)
96  {
97  return fftwf_plan_dft_r2c_2d(nx,ny,in,out,flags);
98  }
99  static PlanType Plan_dft_r2c_3d(int nx,
100  int ny,
101  int nz,
102  PixelType *in,
103  ComplexType *out,
104  unsigned flags)
105  {
106  return fftwf_plan_dft_r2c_3d(nx,ny,nz,in,out,flags);
107  }
108  static PlanType Plan_dft_r2c(int rank,
109  const int *n,
110  PixelType *in,
111  ComplexType *out,
112  unsigned flags)
113  {
114  return fftwf_plan_dft_r2c(rank,n,in,out,flags);
115  }
116 
117  static void Execute(PlanType p)
118  {
119  fftwf_execute(p);
120  }
121  static void DestroyPlan(PlanType p)
122  {
123  fftwf_destroy_plan(p);
124  }
125 };
126 #endif // USE_FFTWF
127 #if defined(USE_FFTWD)
128 template <>
129 class Proxy<double>
130 {
131 public:
132  typedef double PixelType;
133  typedef fftw_complex ComplexType;
134  typedef fftw_plan PlanType;
135 
136  static PlanType Plan_dft_c2r_1d(int n,
137  ComplexType *in,
138  PixelType *out,
139  unsigned flags)
140  {
141  return fftw_plan_dft_c2r_1d(n,in,out,flags);
142  }
143  static PlanType Plan_dft_c2r_2d(int nx,
144  int ny,
145  ComplexType *in,
146  PixelType *out,
147  unsigned flags)
148  {
149  return fftw_plan_dft_c2r_2d(nx,ny,in,out,flags);
150  }
151  static PlanType Plan_dft_c2r_3d(int nx,
152  int ny,
153  int nz,
154  ComplexType *in,
155  PixelType *out,
156  unsigned flags)
157  {
158  return fftw_plan_dft_c2r_3d(nx,ny,nz,in,out,flags);
159  }
160  static PlanType Plan_dft_c2r(int rank,
161  const int *n,
162  ComplexType *in,
163  PixelType *out,
164  unsigned flags)
165  {
166  return fftw_plan_dft_c2r(rank,n,in,out,flags);
167  }
168 
169  static PlanType Plan_dft_r2c_1d(int n,
170  PixelType *in,
171  ComplexType *out,
172  unsigned flags)
173  {
174  return fftw_plan_dft_r2c_1d(n,in,out,flags);
175  }
176  static PlanType Plan_dft_r2c_2d(int nx,
177  int ny,
178  PixelType *in,
179  ComplexType *out,
180  unsigned flags)
181  {
182  return fftw_plan_dft_r2c_2d(nx,ny,in,out,flags);
183  }
184  static PlanType Plan_dft_r2c_3d(int nx,
185  int ny,
186  int nz,
187  PixelType *in,
188  ComplexType *out,
189  unsigned flags)
190  {
191  return fftw_plan_dft_r2c_3d(nx,ny,nz,in,out,flags);
192  }
193  static PlanType Plan_dft_r2c(int rank,
194  const int *n,
195  PixelType *in,
196  ComplexType *out,
197  unsigned flags)
198  {
199  return fftw_plan_dft_r2c(rank,n,in,out,flags);
200  }
201  static void Execute(PlanType p)
202  {
203  fftw_execute(p);
204  }
205  static void DestroyPlan(PlanType p)
206  {
207  fftw_destroy_plan(p);
208  }
209 };
210 #endif
211 }
212 }
213 #endif

Generated at Sat Feb 2 2013 23:37:28 for Orfeo Toolbox with doxygen 1.8.1.1