ITK  5.4.0
Insight Toolkit
itkFFTWComplexToComplexFFTImageFilter.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 #ifndef itkFFTWComplexToComplexFFTImageFilter_h
19 #define itkFFTWComplexToComplexFFTImageFilter_h
20 
22 #include "itkFFTWCommon.h"
23 
25 
26 namespace itk
27 {
58 template <typename TInputImage, typename TOutputImage = TInputImage>
59 class ITK_TEMPLATE_EXPORT FFTWComplexToComplexFFTImageFilter
60  : public ComplexToComplexFFTImageFilter<TInputImage, TOutputImage>
61 {
62 public:
63  ITK_DISALLOW_COPY_AND_MOVE(FFTWComplexToComplexFFTImageFilter);
64 
70 
71  using typename Superclass::ImageType;
72  using PixelType = typename ImageType::PixelType;
73  using typename Superclass::InputImageType;
74  using typename Superclass::OutputImageType;
76 
77  // the proxy type is a wrapper for the fftw API
78  // since the proxy is only defined over double and float,
79  // trying to use any other pixel type is inoperative, as
80  // is trying to use double if only the float FFTW version is
81  // configured in, or float if only double is configured.
82  //
84 
86  itkNewMacro(Self);
87 
89  itkOverrideGetNameOfClassMacro(FFTWComplexToComplexFFTImageFilter);
90 
91  static constexpr unsigned int ImageDimension = ImageType::ImageDimension;
92 
95 
107  virtual void
108  SetPlanRigor(const int & value)
109  {
110 #ifndef ITK_USE_CUFFTW
111  // use that method to check the value
113 #endif
114  if (m_PlanRigor != value)
115  {
116  m_PlanRigor = value;
117  this->Modified();
118  }
119  }
120  itkGetConstReferenceMacro(PlanRigor, int);
121  void
122  SetPlanRigor(const std::string & name)
123  {
124 #ifndef ITK_USE_CUFFTW
125  this->SetPlanRigor(FFTWGlobalConfiguration::GetPlanRigorValue(name));
126 #endif
127  }
130 protected:
132  ~FFTWComplexToComplexFFTImageFilter() override = default;
133 
134  void
135  UpdateOutputData(DataObject * output) override;
136 
137  void
138  BeforeThreadedGenerateData() override;
139 
140  void
141  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
142 
143  void
144  PrintSelf(std::ostream & os, Indent indent) const override;
145 
146 private:
147  bool m_CanUseDestructiveAlgorithm{};
148 
149  int m_PlanRigor{};
150 };
151 
152 
153 // Describe whether input/output are real- or complex-valued
154 // for factory registration
155 template <>
157 {
158  template <typename TUnderlying>
159  using InputPixelType = std::complex<TUnderlying>;
160  template <typename TUnderlying>
161  using OutputPixelType = std::complex<TUnderlying>;
162  using FilterDimensions = std::integer_sequence<unsigned int, 4, 3, 2, 1>;
163 };
164 
165 
166 } // namespace itk
167 
168 #ifndef ITK_MANUAL_INSTANTIATION
169 # include "itkFFTWComplexToComplexFFTImageFilter.hxx"
170 #endif
171 
172 #endif // itkFFTWComplexToComplexFFTImageFilter_h
itk::FFTWComplexToComplexFFTImageFilter::SetPlanRigor
void SetPlanRigor(const std::string &name)
Definition: itkFFTWComplexToComplexFFTImageFilter.h:122
itk::FFTImageFilterTraits< FFTWComplexToComplexFFTImageFilter >::FilterDimensions
std::integer_sequence< unsigned int, 4, 3, 2, 1 > FilterDimensions
Definition: itkFFTWComplexToComplexFFTImageFilter.h:162
itk::FFTWGlobalConfiguration::GetPlanRigorName
static std::string GetPlanRigorName(const int value)
itk::FFTWComplexToComplexFFTImageFilter::FFTWProxyType
typename fftw::Proxy< typename PixelType::value_type > FFTWProxyType
Definition: itkFFTWComplexToComplexFFTImageFilter.h:83
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::FFTImageFilterTraits
Helper defining pixel traits for templated FFT image filters.
Definition: itkFFTImageFilterFactory.h:42
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FFTWComplexToComplexFFTImageFilter::SetPlanRigor
virtual void SetPlanRigor(const int &value)
Definition: itkFFTWComplexToComplexFFTImageFilter.h:108
itk::ComplexToComplexFFTImageFilter
Implements an API to enable the Fourier transform or the inverse Fourier transform of images with com...
Definition: itkComplexToComplexFFTImageFilter.h:75
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::FFTWGlobalConfiguration::GetPlanRigorValue
static int GetPlanRigorValue(const std::string &name)
itk::FFTWComplexToComplexFFTImageFilter::PixelType
typename ImageType::PixelType PixelType
Definition: itkFFTWComplexToComplexFFTImageFilter.h:72
itk::FFTWComplexToComplexFFTImageFilter
Implements an API to enable the Fourier transform or the inverse Fourier transform of images with com...
Definition: itkFFTWComplexToComplexFFTImageFilter.h:59
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkFFTWCommon.h
itk::FFTImageFilterTraits< FFTWComplexToComplexFFTImageFilter >::InputPixelType
std::complex< TUnderlying > InputPixelType
Definition: itkFFTWComplexToComplexFFTImageFilter.h:159
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itkComplexToComplexFFTImageFilter.h
itk::FFTImageFilterTraits< FFTWComplexToComplexFFTImageFilter >::OutputPixelType
std::complex< TUnderlying > OutputPixelType
Definition: itkFFTWComplexToComplexFFTImageFilter.h:161
itkFFTImageFilterFactory.h
itk::ComplexToComplexFFTImageFilter::ImageSizeType
typename ImageType::SizeType ImageSizeType
Definition: itkComplexToComplexFFTImageFilter.h:111
itk::fftw::Proxy
Definition: itkFFTWCommon.h:54
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293