ITK  5.3.0
Insight Toolkit
itkFFTConvolutionImageFilter.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  * http://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 itkFFTConvolutionImageFilter_h
19 #define itkFFTConvolutionImageFilter_h
20 
22 
23 #include "itkProgressAccumulator.h"
27 
28 namespace itk
29 {
54 template <typename TInputImage,
55  typename TKernelImage = TInputImage,
56  typename TOutputImage = TInputImage,
57  typename TInternalPrecision = double>
58 class ITK_TEMPLATE_EXPORT FFTConvolutionImageFilter
59  : public ConvolutionImageFilterBase<TInputImage, TKernelImage, TOutputImage>
60 
61 {
62 public:
63  ITK_DISALLOW_COPY_AND_MOVE(FFTConvolutionImageFilter);
64 
69 
71  itkNewMacro(Self);
72 
75 
77  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
78 
79  using InputImageType = TInputImage;
80  using OutputImageType = TOutputImage;
81  using KernelImageType = TKernelImage;
82  using InputPixelType = typename InputImageType::PixelType;
83  using OutputPixelType = typename OutputImageType::PixelType;
84  using KernelPixelType = typename KernelImageType::PixelType;
95 
99  using InternalComplexType = std::complex<TInternalPrecision>;
102 
104  using BoundaryConditionType = typename Superclass::BoundaryConditionType;
105  using BoundaryConditionPointerType = typename Superclass::BoundaryConditionPointerType;
106 
107  itkSetMacro(SizeGreatestPrimeFactor, SizeValueType);
108  itkGetMacro(SizeGreatestPrimeFactor, SizeValueType);
109 
110 protected:
112  ~FFTConvolutionImageFilter() override = default;
113 
118 
126  void
127  GenerateInputRequestedRegion() override;
128 
130  void
131  GenerateData() override;
132 
137  void
138  PrepareInputs(const InputImageType * input,
139  const KernelImageType * kernel,
140  InternalComplexImagePointerType & preparedInput,
141  InternalComplexImagePointerType & preparedKernel,
142  ProgressAccumulator * progress,
143  float progressWeight);
144 
147  void
148  PrepareInput(const InputImageType * input,
149  InternalComplexImagePointerType & preparedInput,
150  ProgressAccumulator * progress,
151  float progressWeight);
152 
154  void
155  PadInput(const InputImageType * input,
156  InternalImagePointerType & paddedInput,
157  ProgressAccumulator * progress,
158  float progressWeight);
159 
161  void
162  TransformPaddedInput(const InternalImageType * paddedInput,
163  InternalComplexImagePointerType & transformedInput,
164  ProgressAccumulator * progress,
165  float progressWeight);
166 
170  void
171  PrepareKernel(const KernelImageType * kernel,
172  InternalComplexImagePointerType & preparedKernel,
173  ProgressAccumulator * progress,
174  float progressWeight);
175 
177  void
178  ProduceOutput(InternalComplexImageType * paddedOutput, ProgressAccumulator * progress, float progressWeight);
179 
181  void
182  CropOutput(InternalImageType * paddedOutput, ProgressAccumulator * progress, float progressWeight);
183 
191  GetPadLowerBound() const;
192 
195  GetPadSize() const;
196 
198  bool
199  GetXDimensionIsOdd() const;
200 
201  void
202  PrintSelf(std::ostream & os, Indent indent) const override;
203 
204 private:
206 };
207 } // namespace itk
208 
209 #ifndef ITK_MANUAL_INSTANTIATION
210 # include "itkFFTConvolutionImageFilter.hxx"
211 #endif
212 
213 #endif
itk::FFTConvolutionImageFilter
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain.
Definition: itkFFTConvolutionImageFilter.h:58
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::OutputRegionType
typename OutputImageType::RegionType OutputRegionType
Definition: itkConvolutionImageFilterBase.h:88
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::KernelImageType
TKernelSource::OutputImageType KernelImageType
Definition: itkConvolutionImageFilterBase.h:76
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::SizeValueType
typename InputSizeType::SizeValueType SizeValueType
Definition: itkConvolutionImageFilterBase.h:86
itkConvolutionImageFilterBase.h
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkConvolutionImageFilterBase.h:81
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkConvolutionImageFilterBase.h:80
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::KernelPixelType
typename KernelImageType::PixelType KernelPixelType
Definition: itkConvolutionImageFilterBase.h:79
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkRealToHalfHermitianForwardFFTImageFilter.h
itk::RealToHalfHermitianForwardFFTImageFilter
Base class for specialized real-to-complex forward Fast Fourier Transform.
Definition: itkRealToHalfHermitianForwardFFTImageFilter.h:56
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkConvolutionImageFilterBase.h:84
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkConvolutionImageFilterBase.h:77
itk::FFTConvolutionImageFilter< TInputImage, TKernelSource::OutputImageType, TOutputImage, double >::InternalComplexImagePointerType
typename InternalComplexImageType::Pointer InternalComplexImagePointerType
Definition: itkFFTConvolutionImageFilter.h:101
itk::ImageBoundaryCondition
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
Definition: itkImageBoundaryCondition.h:52
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::FFTConvolutionImageFilter< TInputImage, TKernelSource::OutputImageType, TOutputImage, double >::InternalComplexType
std::complex< double > InternalComplexType
Definition: itkFFTConvolutionImageFilter.h:99
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::KernelIndexType
typename KernelImageType::IndexType KernelIndexType
Definition: itkConvolutionImageFilterBase.h:82
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkHalfHermitianToRealInverseFFTImageFilter.h
itk::ProgressAccumulator
Facilitates progress reporting for filters that wrap around multiple other filters.
Definition: itkProgressAccumulator.h:40
itk::FFTConvolutionImageFilter::m_SizeGreatestPrimeFactor
SizeValueType m_SizeGreatestPrimeFactor
Definition: itkFFTConvolutionImageFilter.h:205
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkConvolutionImageFilterBase.h:78
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkProgressAccumulator.h
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::InputRegionType
typename InputImageType::RegionType InputRegionType
Definition: itkConvolutionImageFilterBase.h:87
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkConvolutionImageFilterBase.h:83
itk::HalfHermitianToRealInverseFFTImageFilter
Base class for specialized complex-to-real inverse Fast Fourier Transform.
Definition: itkHalfHermitianToRealInverseFFTImageFilter.h:56
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::KernelRegionType
typename KernelImageType::RegionType KernelRegionType
Definition: itkConvolutionImageFilterBase.h:89
itkZeroFluxNeumannBoundaryCondition.h
itk::ConvolutionImageFilterBase
Abstract base class for the convolution image filters.
Definition: itkConvolutionImageFilterBase.h:58
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::FFTConvolutionImageFilter< TInputImage, TKernelSource::OutputImageType, TOutputImage, double >::InternalImagePointerType
typename InternalImageType::Pointer InternalImagePointerType
Definition: itkFFTConvolutionImageFilter.h:98
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::ConvolutionImageFilterBase< TInputImage, TKernelSource::OutputImageType, TOutputImage >::KernelSizeType
typename KernelImageType::SizeType KernelSizeType
Definition: itkConvolutionImageFilterBase.h:85