18#ifndef itkFFTWCommonExtended_h
19#define itkFFTWCommonExtended_h
21#if defined(ITK_USE_FFTWF) || defined(ITK_USE_FFTWD)
22# if defined(ITK_USE_CUFFTW)
43template <
typename TPixel>
44class ComplexToComplexProxy
52#if defined(ITK_USE_FFTWF)
58 using PixelType = float;
59 using ComplexType = fftwf_complex;
60 using PlanType = fftwf_plan;
64 Plan_dft_c2r_1d(
int n, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
66# ifndef ITK_USE_CUFFTW
68 fftwf_plan_with_nthreads(threads);
72 PlanType plan = fftwf_plan_dft_c2r_1d(n, in, out, flags);
76 Plan_dft_c2r_2d(
int nx,
int ny, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
78# ifndef ITK_USE_CUFFTW
80 fftwf_plan_with_nthreads(threads);
84 PlanType plan = fftwf_plan_dft_c2r_2d(nx, ny, in, out, flags);
88 Plan_dft_c2r_3d(
int nx,
int ny,
int nz, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
90# ifndef ITK_USE_CUFFTW
92 fftwf_plan_with_nthreads(threads);
96 PlanType plan = fftwf_plan_dft_c2r_3d(nx, ny, nz, in, out, flags);
100 Plan_dft_c2r(
int rank,
const int * n, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
102# ifndef ITK_USE_CUFFTW
104 fftwf_plan_with_nthreads(threads);
108 PlanType plan = fftwf_plan_dft_c2r(rank, n, in, out, flags);
113 Plan_dft_r2c_1d(
int n, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
115# ifndef ITK_USE_CUFFTW
117 fftwf_plan_with_nthreads(threads);
121 PlanType plan = fftwf_plan_dft_r2c_1d(n, in, out, flags);
125 Plan_dft_r2c_2d(
int nx,
int ny, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
127# ifndef ITK_USE_CUFFTW
129 fftwf_plan_with_nthreads(threads);
133 PlanType plan = fftwf_plan_dft_r2c_2d(nx, ny, in, out, flags);
137 Plan_dft_r2c_3d(
int nx,
int ny,
int nz, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
139# ifndef ITK_USE_CUFFTW
141 fftwf_plan_with_nthreads(threads);
145 PlanType plan = fftwf_plan_dft_r2c_3d(nx, ny, nz, in, out, flags);
149 Plan_dft_r2c(
int rank,
const int * n, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
151# ifndef ITK_USE_CUFFTW
153 fftwf_plan_with_nthreads(threads);
157 PlanType plan = fftwf_plan_dft_r2c(rank, n, in, out, flags);
161 Plan_dft_1d(
const int n, ComplexType * in, ComplexType * out,
int sign,
unsigned flags,
int threads = 1)
163# ifndef ITK_USE_CUFFTW
165 fftwf_plan_with_nthreads(threads);
169 PlanType plan = fftwf_plan_dft_1d(n, in, out, sign, flags);
180 DestroyPlan(PlanType p)
182 fftwf_destroy_plan(p);
189#if defined(ITK_USE_FFTWD)
194 using PixelType = double;
195 using ComplexType = fftw_complex;
196 using PlanType = fftw_plan;
200 Plan_dft_c2r_1d(
int n, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
202# ifndef ITK_USE_CUFFTW
204 fftw_plan_with_nthreads(threads);
208 PlanType plan = fftw_plan_dft_c2r_1d(n, in, out, flags);
212 Plan_dft_c2r_2d(
int nx,
int ny, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
214# ifndef ITK_USE_CUFFTW
216 fftw_plan_with_nthreads(threads);
220 PlanType plan = fftw_plan_dft_c2r_2d(nx, ny, in, out, flags);
224 Plan_dft_c2r_3d(
int nx,
int ny,
int nz, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
226# ifndef ITK_USE_CUFFTW
228 fftw_plan_with_nthreads(threads);
232 PlanType plan = fftw_plan_dft_c2r_3d(nx, ny, nz, in, out, flags);
236 Plan_dft_c2r(
int rank,
const int * n, ComplexType * in, PixelType * out,
unsigned flags,
int threads = 1)
238# ifndef ITK_USE_CUFFTW
240 fftw_plan_with_nthreads(threads);
244 PlanType plan = fftw_plan_dft_c2r(rank, n, in, out, flags);
249 Plan_dft_r2c_1d(
int n, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
251# ifndef ITK_USE_CUFFTW
253 fftw_plan_with_nthreads(threads);
257 PlanType plan = fftw_plan_dft_r2c_1d(n, in, out, flags);
262 Plan_dft_r2c_2d(
int nx,
int ny, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
264# ifndef ITK_USE_CUFFTW
266 fftw_plan_with_nthreads(threads);
270 PlanType plan = fftw_plan_dft_r2c_2d(nx, ny, in, out, flags);
275 Plan_dft_r2c_3d(
int nx,
int ny,
int nz, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
277# ifndef ITK_USE_CUFFTW
279 fftw_plan_with_nthreads(threads);
283 PlanType plan = fftw_plan_dft_r2c_3d(nx, ny, nz, in, out, flags);
288 Plan_dft_r2c(
int rank,
const int * n, PixelType * in, ComplexType * out,
unsigned flags,
int threads = 1)
290# ifndef ITK_USE_CUFFTW
292 fftw_plan_with_nthreads(threads);
296 PlanType plan = fftw_plan_dft_r2c(rank, n, in, out, flags);
300 Plan_dft_1d(
const int n, ComplexType * in, ComplexType * out,
int sign,
unsigned flags,
int threads = 1)
302# ifndef ITK_USE_CUFFTW
304 fftw_plan_with_nthreads(threads);
308 PlanType plan = fftw_plan_dft_1d(n, in, out, sign, flags);
318 DestroyPlan(PlanType p)
320 fftw_destroy_plan(p);
static std::mutex & GetLockMutex()
~ComplexToComplexProxy()=default
ComplexToComplexProxy()=default
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....