ITK  4.13.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:
60  typedef ConvolutionImageFilterBase< TInputImage,
61  TKernelImage,
62  TOutputImage >
66 
68  itkNewMacro(Self);
69 
72 
74  itkStaticConstMacro(ImageDimension, unsigned int,
75  TInputImage::ImageDimension);
76 
77  typedef TInputImage InputImageType;
78  typedef TOutputImage OutputImageType;
79  typedef TKernelImage KernelImageType;
80  typedef typename InputImageType::PixelType InputPixelType;
81  typedef typename OutputImageType::PixelType OutputPixelType;
82  typedef typename KernelImageType::PixelType KernelPixelType;
90  typedef typename InputImageType::RegionType InputRegionType;
91  typedef typename OutputImageType::RegionType OutputRegionType;
92  typedef typename KernelImageType::RegionType KernelRegionType;
93 
97  typedef std::complex< TInternalPrecision > InternalComplexType;
100 
102  typedef typename Superclass::BoundaryConditionType BoundaryConditionType;
103  typedef typename Superclass::BoundaryConditionPointerType BoundaryConditionPointerType;
104 
105  itkSetMacro(SizeGreatestPrimeFactor, SizeValueType);
106  itkGetMacro(SizeGreatestPrimeFactor, SizeValueType);
107 
108 protected:
110  ~FFTConvolutionImageFilter() ITK_OVERRIDE {}
111 
114  typedef RealToHalfHermitianForwardFFTImageFilter< InternalImageType,
115  InternalComplexImageType >
120 
128  void GenerateInputRequestedRegion() ITK_OVERRIDE;
129 
131  void GenerateData() ITK_OVERRIDE;
132 
137  void PrepareInputs(const InputImageType * input,
138  const KernelImageType * kernel,
139  InternalComplexImagePointerType & preparedInput,
140  InternalComplexImagePointerType & preparedKernel,
141  ProgressAccumulator * progress, float progressWeight);
142 
145  void PrepareInput(const InputImageType * input,
146  InternalComplexImagePointerType & preparedInput,
147  ProgressAccumulator * progress, float progressWeight);
148 
150  void PadInput(const InputImageType * input,
151  InternalImagePointerType & paddedInput,
152  ProgressAccumulator * progress, float progressWeight);
153 
155  void TransformPaddedInput(const InternalImageType * paddedInput,
156  InternalComplexImagePointerType & transformedInput,
157  ProgressAccumulator * progress, float progressWeight);
158 
162  void PrepareKernel(const KernelImageType * kernel,
163  InternalComplexImagePointerType & preparedKernel,
164  ProgressAccumulator * progress, float progressWeight);
165 
167  void ProduceOutput(InternalComplexImageType * paddedOutput,
168  ProgressAccumulator * progress,
169  float progressWeight);
170 
172  void CropOutput(InternalImageType * paddedOutput,
173  ProgressAccumulator * progress,
174  float progressWeight);
175 
182  InputSizeType GetPadLowerBound() const;
183 
185  InputSizeType GetPadSize() const;
186 
188  bool GetXDimensionIsOdd() const;
189 
190  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
191 
192 private:
193  ITK_DISALLOW_COPY_AND_ASSIGN(FFTConvolutionImageFilter);
194 
195  SizeValueType m_SizeGreatestPrimeFactor;
196 };
197 }
198 
199 #ifndef ITK_MANUAL_INSTANTIATION
200 #include "itkFFTConvolutionImageFilter.hxx"
201 #endif
202 
203 #endif
OutputImageType::RegionType OutputRegionType
InputImageType::RegionType InputRegionType
RealToHalfHermitianForwardFFTImageFilter< InternalImageType, InternalComplexImageType > FFTFilterType
Superclass::BoundaryConditionType BoundaryConditionType
HalfHermitianToRealInverseFFTImageFilter< InternalComplexImageType, InternalImageType > IFFTFilterType
InternalComplexImageType::Pointer InternalComplexImagePointerType
InputSizeType::SizeValueType SizeValueType
Abstract base class for the convolution image filters.
Superclass::BoundaryConditionPointerType BoundaryConditionPointerType
Base class for all process objects that output image data.
InternalImageType::Pointer InternalImagePointerType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
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.
Image< InternalComplexType, TInputImage::ImageDimension > InternalComplexImageType
KernelImageType::RegionType KernelRegionType
Facilitates progress reporting for filters that wrap around multiple other filters.
OutputImageType::PixelType OutputPixelType
ConvolutionImageFilterBase< TInputImage, TKernelImage, TOutputImage > Superclass
OutputImageType::IndexType OutputIndexType
KernelImageType::IndexType KernelIndexType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for specialized real-to-complex forward Fast Fourier Transform.
KernelImageType::PixelType KernelPixelType
Image< TInternalPrecision, TInputImage::ImageDimension > InternalImageType
Templated n-dimensional image class.
Definition: itkImage.h:75
std::complex< TInternalPrecision > InternalComplexType