ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkFFTConvolutionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
53 template< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
54 class ITK_TEMPLATE_EXPORT FFTConvolutionImageFilter :
55  public ConvolutionImageFilterBase< TInputImage, TKernelImage, TOutputImage >
56 
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_ASSIGN(FFTConvolutionImageFilter);
60 
62  using Superclass = ConvolutionImageFilterBase< TInputImage,
63  TKernelImage,
64  TOutputImage >;
67 
69  itkNewMacro(Self);
70 
73 
75  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
76 
77  using InputImageType = TInputImage;
78  using OutputImageType = TOutputImage;
79  using KernelImageType = TKernelImage;
80  using InputPixelType = typename InputImageType::PixelType;
81  using OutputPixelType = typename OutputImageType::PixelType;
82  using KernelPixelType = typename KernelImageType::PixelType;
93 
97  using InternalComplexType = std::complex< TInternalPrecision >;
100 
102  using BoundaryConditionType = typename Superclass::BoundaryConditionType;
103  using BoundaryConditionPointerType = typename Superclass::BoundaryConditionPointerType;
104 
105  itkSetMacro(SizeGreatestPrimeFactor, SizeValueType);
106  itkGetMacro(SizeGreatestPrimeFactor, SizeValueType);
107 
108 protected:
110  ~FFTConvolutionImageFilter() override = default;
111 
118 
126  void GenerateInputRequestedRegion() override;
127 
129  void GenerateData() override;
130 
135  void PrepareInputs(const InputImageType * input,
136  const KernelImageType * kernel,
137  InternalComplexImagePointerType & preparedInput,
138  InternalComplexImagePointerType & preparedKernel,
139  ProgressAccumulator * progress, float progressWeight);
140 
143  void PrepareInput(const InputImageType * input,
144  InternalComplexImagePointerType & preparedInput,
145  ProgressAccumulator * progress, float progressWeight);
146 
148  void PadInput(const InputImageType * input,
149  InternalImagePointerType & paddedInput,
150  ProgressAccumulator * progress, float progressWeight);
151 
153  void TransformPaddedInput(const InternalImageType * paddedInput,
154  InternalComplexImagePointerType & transformedInput,
155  ProgressAccumulator * progress, float progressWeight);
156 
160  void PrepareKernel(const KernelImageType * kernel,
161  InternalComplexImagePointerType & preparedKernel,
162  ProgressAccumulator * progress, float progressWeight);
163 
165  void ProduceOutput(InternalComplexImageType * paddedOutput,
166  ProgressAccumulator * progress,
167  float progressWeight);
168 
170  void CropOutput(InternalImageType * paddedOutput,
171  ProgressAccumulator * progress,
172  float progressWeight);
173 
180  InputSizeType GetPadLowerBound() const;
181 
183  InputSizeType GetPadSize() const;
184 
186  bool GetXDimensionIsOdd() const;
187 
188  void PrintSelf(std::ostream & os, Indent indent) const override;
189 
190 private:
192 };
193 }
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "itkFFTConvolutionImageFilter.hxx"
197 #endif
198 
199 #endif
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Abstract base class for the convolution image filters.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain...
Base class for specialized complex-to-real inverse Fast Fourier Transform.
TOutputImage OutputImageType
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
Facilitates progress reporting for filters that wrap around multiple other filters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for specialized real-to-complex forward Fast Fourier Transform.
Templated n-dimensional image class.
Definition: itkImage.h:75