18#ifndef itkFFTWCommonExtended_h
19#define itkFFTWCommonExtended_h
21#if defined(ITK_USE_FFTWF) || defined(ITK_USE_FFTWD)
22# if defined(ITK_USE_CUFFTW)
41template <
typename TPixel>
50#if defined(ITK_USE_FFTWF)
56 using PixelType = float;
57 using ComplexType = fftwf_complex;
58 using PlanType = fftwf_plan;
62 Plan_dft_c2r_1d(
int n, ComplexType * in, PixelType * out,
unsigned int flags, [[maybe_unused]]
int threads = 1)
64# ifndef ITK_USE_CUFFTW
66 fftwf_plan_with_nthreads(threads);
68 PlanType plan = fftwf_plan_dft_c2r_1d(n, in, out, flags);
72 Plan_dft_c2r_2d(
int nx,
77 [[maybe_unused]]
int threads = 1)
79# ifndef ITK_USE_CUFFTW
81 fftwf_plan_with_nthreads(threads);
83 PlanType plan = fftwf_plan_dft_c2r_2d(nx, ny, in, out, flags);
87 Plan_dft_c2r_3d(
int nx,
93 [[maybe_unused]]
int threads = 1)
95# ifndef ITK_USE_CUFFTW
97 fftwf_plan_with_nthreads(threads);
99 PlanType plan = fftwf_plan_dft_c2r_3d(nx, ny, nz, in, out, flags);
103 Plan_dft_c2r(
int rank,
108 [[maybe_unused]]
int threads = 1)
110# ifndef ITK_USE_CUFFTW
112 fftwf_plan_with_nthreads(threads);
114 PlanType plan = fftwf_plan_dft_c2r(rank, n, in, out, flags);
119 Plan_dft_r2c_1d(
int n, PixelType * in, ComplexType * out,
unsigned int flags, [[maybe_unused]]
int threads = 1)
121# ifndef ITK_USE_CUFFTW
123 fftwf_plan_with_nthreads(threads);
125 PlanType plan = fftwf_plan_dft_r2c_1d(n, in, out, flags);
129 Plan_dft_r2c_2d(
int nx,
134 [[maybe_unused]]
int threads = 1)
136# ifndef ITK_USE_CUFFTW
138 fftwf_plan_with_nthreads(threads);
140 PlanType plan = fftwf_plan_dft_r2c_2d(nx, ny, in, out, flags);
144 Plan_dft_r2c_3d(
int nx,
150 [[maybe_unused]]
int threads = 1)
152# ifndef ITK_USE_CUFFTW
154 fftwf_plan_with_nthreads(threads);
156 PlanType plan = fftwf_plan_dft_r2c_3d(nx, ny, nz, in, out, flags);
160 Plan_dft_r2c(
int rank,
165 [[maybe_unused]]
int threads = 1)
167# ifndef ITK_USE_CUFFTW
169 fftwf_plan_with_nthreads(threads);
171 PlanType plan = fftwf_plan_dft_r2c(rank, n, in, out, flags);
175 Plan_dft_1d(
const int n,
180 [[maybe_unused]]
int threads = 1)
182# ifndef ITK_USE_CUFFTW
184 fftwf_plan_with_nthreads(threads);
186 PlanType plan = fftwf_plan_dft_1d(n, in, out, sign, flags);
197 DestroyPlan(PlanType p)
199 fftwf_destroy_plan(p);
206#if defined(ITK_USE_FFTWD)
211 using PixelType = double;
212 using ComplexType = fftw_complex;
213 using PlanType = fftw_plan;
217 Plan_dft_c2r_1d(
int n, ComplexType * in, PixelType * out,
unsigned int flags, [[maybe_unused]]
int threads = 1)
219# ifndef ITK_USE_CUFFTW
221 fftw_plan_with_nthreads(threads);
223 PlanType plan = fftw_plan_dft_c2r_1d(n, in, out, flags);
227 Plan_dft_c2r_2d(
int nx,
232 [[maybe_unused]]
int threads = 1)
234# ifndef ITK_USE_CUFFTW
236 fftw_plan_with_nthreads(threads);
238 PlanType plan = fftw_plan_dft_c2r_2d(nx, ny, in, out, flags);
242 Plan_dft_c2r_3d(
int nx,
248 [[maybe_unused]]
int threads = 1)
250# ifndef ITK_USE_CUFFTW
252 fftw_plan_with_nthreads(threads);
254 PlanType plan = fftw_plan_dft_c2r_3d(nx, ny, nz, in, out, flags);
258 Plan_dft_c2r(
int rank,
263 [[maybe_unused]]
int threads = 1)
265# ifndef ITK_USE_CUFFTW
267 fftw_plan_with_nthreads(threads);
269 PlanType plan = fftw_plan_dft_c2r(rank, n, in, out, flags);
274 Plan_dft_r2c_1d(
int n, PixelType * in, ComplexType * out,
unsigned int flags, [[maybe_unused]]
int threads = 1)
276# ifndef ITK_USE_CUFFTW
278 fftw_plan_with_nthreads(threads);
280 PlanType plan = fftw_plan_dft_r2c_1d(n, in, out, flags);
285 Plan_dft_r2c_2d(
int nx,
290 [[maybe_unused]]
int threads = 1)
292# ifndef ITK_USE_CUFFTW
294 fftw_plan_with_nthreads(threads);
296 PlanType plan = fftw_plan_dft_r2c_2d(nx, ny, in, out, flags);
301 Plan_dft_r2c_3d(
int nx,
307 [[maybe_unused]]
int threads = 1)
309# ifndef ITK_USE_CUFFTW
311 fftw_plan_with_nthreads(threads);
313 PlanType plan = fftw_plan_dft_r2c_3d(nx, ny, nz, in, out, flags);
318 Plan_dft_r2c(
int rank,
323 [[maybe_unused]]
int threads = 1)
325# ifndef ITK_USE_CUFFTW
327 fftw_plan_with_nthreads(threads);
329 PlanType plan = fftw_plan_dft_r2c(rank, n, in, out, flags);
333 Plan_dft_1d(
const int n,
338 [[maybe_unused]]
int threads = 1)
340# ifndef ITK_USE_CUFFTW
342 fftw_plan_with_nthreads(threads);
344 PlanType plan = fftw_plan_dft_1d(n, in, out, sign, flags);
354 DestroyPlan(PlanType p)
356 fftw_destroy_plan(p);
static std::mutex & GetLockMutex()
~ComplexToComplexProxy()=default
ComplexToComplexProxy()=default