ITK  6.0.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 * 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 itkFFTConvolutionImageFilter_h
19#define itkFFTConvolutionImageFilter_h
20
22
27
28namespace itk
29{
56template <typename TInputImage,
57 typename TKernelImage = TInputImage,
58 typename TOutputImage = TInputImage,
59 typename TInternalPrecision = double>
60class ITK_TEMPLATE_EXPORT FFTConvolutionImageFilter
61 : public ConvolutionImageFilterBase<TInputImage, TKernelImage, TOutputImage>
62
63{
64public:
65 ITK_DISALLOW_COPY_AND_MOVE(FFTConvolutionImageFilter);
66
71
73 itkNewMacro(Self);
74
76 itkOverrideGetNameOfClassMacro(FFTConvolutionImageFilter);
77
79 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
80
81 using InputImageType = TInputImage;
82 using OutputImageType = TOutputImage;
83 using KernelImageType = TKernelImage;
84 using InputPixelType = typename InputImageType::PixelType;
85 using OutputPixelType = typename OutputImageType::PixelType;
86 using KernelPixelType = typename KernelImageType::PixelType;
97
104 using InternalComplexType = std::complex<TInternalPrecision>;
107
109 using typename Superclass::BoundaryConditionType;
110
111 itkSetMacro(SizeGreatestPrimeFactor, SizeValueType);
112 itkGetMacro(SizeGreatestPrimeFactor, SizeValueType);
113
114protected:
116 ~FFTConvolutionImageFilter() override = default;
117
122
129 void
131
133 void
134 GenerateData() override;
135
140 void
142 const KernelImageType * kernel,
143 InternalComplexImagePointerType & preparedInput,
144 InternalComplexImagePointerType & preparedKernel,
145 ProgressAccumulator * progress,
146 float progressWeight);
147
150 void
152 InternalComplexImagePointerType & preparedInput,
153 ProgressAccumulator * progress,
154 float progressWeight);
155
157 void
159 InternalImagePointerType & paddedInput,
160 ProgressAccumulator * progress,
161 float progressWeight);
162
164 void
166 InternalComplexImagePointerType & transformedInput,
167 ProgressAccumulator * progress,
168 float progressWeight);
169
173 void
175 InternalComplexImagePointerType & preparedKernel,
176 ProgressAccumulator * progress,
177 float progressWeight);
178
180 void
181 ProduceOutput(InternalComplexImageType * paddedOutput, ProgressAccumulator * progress, float progressWeight);
182
184 void
185 CropOutput(InternalImageType * paddedOutput, ProgressAccumulator * progress, float progressWeight);
186
191
200
202 bool
204
205 void
206 PrintSelf(std::ostream & os, Indent indent) const override;
207
208private:
209 SizeValueType m_SizeGreatestPrimeFactor{};
210 InternalSizeType m_FFTPadSize{ { 0 } };
211 InternalRegionType m_PaddedInputRegion{};
212};
213} // namespace itk
214
215#ifndef ITK_MANUAL_INSTANTIATION
216# include "itkFFTConvolutionImageFilter.hxx"
217#endif
218
219#endif
Abstract base class for the convolution image filters.
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain.
void CropOutput(InternalImageType *paddedOutput, ProgressAccumulator *progress, float progressWeight)
typename OutputImageType::IndexType OutputIndexType
KernelSizeType GetKernelRadius() const
typename InternalImageType::SizeType InternalSizeType
void TransformPaddedInput(const InternalImageType *paddedInput, InternalComplexImagePointerType &transformedInput, ProgressAccumulator *progress, float progressWeight)
void PrintSelf(std::ostream &os, Indent indent) const override
void PrepareInput(const InputImageType *input, InternalComplexImagePointerType &preparedInput, ProgressAccumulator *progress, float progressWeight)
typename KernelImageType::SizeType KernelSizeType
typename InternalImageType::IndexType InternalIndexType
typename OutputImageType::PixelType OutputPixelType
typename OutputImageType::RegionType OutputRegionType
void PrepareInputs(const InputImageType *input, const KernelImageType *kernel, InternalComplexImagePointerType &preparedInput, InternalComplexImagePointerType &preparedKernel, ProgressAccumulator *progress, float progressWeight)
void PadInput(const InputImageType *input, InternalImagePointerType &paddedInput, ProgressAccumulator *progress, float progressWeight)
typename InputImageType::IndexType InputIndexType
void ProduceOutput(InternalComplexImageType *paddedOutput, ProgressAccumulator *progress, float progressWeight)
typename InputImageType::PixelType InputPixelType
void GenerateInputRequestedRegion() override
std::complex< TInternalPrecision > InternalComplexType
~FFTConvolutionImageFilter() override=default
InternalSizeType GetFFTPadSize() const
typename KernelImageType::IndexType KernelIndexType
typename OutputImageType::SizeType OutputSizeType
typename InputImageType::RegionType InputRegionType
typename InternalComplexImageType::Pointer InternalComplexImagePointerType
typename KernelImageType::RegionType KernelRegionType
void PrepareKernel(const KernelImageType *kernel, InternalComplexImagePointerType &preparedKernel, ProgressAccumulator *progress, float progressWeight)
typename KernelImageType::PixelType KernelPixelType
typename InputSizeType::SizeValueType SizeValueType
typename InternalImageType::RegionType InternalRegionType
typename InternalImageType::Pointer InternalImagePointerType
typename InputImageType::SizeType InputSizeType
Base class for specialized complex-to-real inverse Fast Fourier Transform.
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Facilitates progress reporting for filters that wrap around multiple other filters.
Base class for specialized real-to-complex forward Fast Fourier Transform.
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86