ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkOpenCLComplexToComplex1DFFTImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#if !defined(itkOpenCLComplexToComplex1DFFTImageFilter_h) && defined(ITKUltrasound_USE_clFFT)
19# define itkOpenCLComplexToComplex1DFFTImageFilter_h
20
22
23# define __CL_ENABLE_EXCEPTIONS
24# include "CL/cl.hpp"
25# include "clFFT.h"
26
27namespace itk
28{
43
44template <typename TInputImage, typename TOutputImage = TInputImage>
45class ITK_TEMPLATE_EXPORT OpenCLComplexToComplex1DFFTImageFilter
46 : public ComplexToComplex1DFFTImageFilter<TInputImage, TOutputImage>
47{
48public:
49 ITK_DISALLOW_COPY_AND_MOVE(OpenCLComplexToComplex1DFFTImageFilter);
50 using TPixel = typename NumericTraits<typename TInputImage::PixelType>::ValueType;
51
52 using Self = OpenCLComplexToComplex1DFFTImageFilter;
53 using Superclass = ComplexToComplex1DFFTImageFilter<TInputImage, TOutputImage>;
54 using Pointer = SmartPointer<Self>;
55 using ConstPointer = SmartPointer<const Self>;
56
58 using InputImageType = typename Superclass::InputImageType;
59 using OutputImageType = typename Superclass::OutputImageType;
60
61 using OpenCLComplexType = std::complex<TPixel>;
62
64 itkNewMacro(Self);
65
67 itkOverrideGetNameOfClassMacro(OpenCLComplexToComplex1DFFTImageFilter);
68
70 GetSizeGreatestPrimeFactor() const override
71 {
72 return 7; // clFFT supports prime factors 2, 3, 5 and 7
73 }
74
75protected:
76 OpenCLComplexToComplex1DFFTImageFilter();
77 ~OpenCLComplexToComplex1DFFTImageFilter() override
78 {
79 if (m_PlanComputed)
80 {
81 clfftDestroyPlan(&this->m_Plan);
82 delete[] this->m_InputBuffer;
83 delete[] this->m_OutputBuffer;
84 }
85 delete m_clQueue;
86 delete m_clContext;
87 }
88
89 virtual void
90 GenerateData(); // generates output from input
91
93 bool
94 Legaldim(int n);
95
96private:
97 bool m_PlanComputed = false;
98 clfftPlanHandle m_Plan = 0;
99 unsigned int m_LastImageSize = 0;
100 OpenCLComplexType * m_InputBuffer = nullptr;
101 OpenCLComplexType * m_OutputBuffer = nullptr;
102 cl::Context * m_clContext = nullptr;
103 cl::CommandQueue * m_clQueue = nullptr;
104};
105
106} // namespace itk
107
108# ifndef ITK_MANUAL_INSTANTIATION
109# include "itkOpenCLComplexToComplex1DFFTImageFilter.hxx"
110# endif
111
112#endif // itkOpenCLComplexToComplex1DFFTImageFilter_h
Perform the Fast Fourier Transform, complex input to complex output, but only along one dimension.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:82