ITK  4.3.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< class TInputImage, class TKernelImage = TInputImage, class TOutputImage = TInputImage, class TInternalPrecision=double >
54 class ITK_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;
83  typedef typename InputImageType::IndexType InputIndexType;
84  typedef typename OutputImageType::IndexType OutputIndexType;
85  typedef typename KernelImageType::IndexType KernelIndexType;
86  typedef typename InputImageType::SizeType InputSizeType;
87  typedef typename OutputImageType::SizeType OutputSizeType;
88  typedef typename KernelImageType::SizeType KernelSizeType;
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 protected:
108 
111  typedef RealToHalfHermitianForwardFFTImageFilter< InternalImageType,
112  InternalComplexImageType >
117 
125  void GenerateInputRequestedRegion();
126 
128  void GenerateData();
129 
134  void PrepareInputs(const InputImageType * input,
135  const KernelImageType * kernel,
136  InternalComplexImagePointerType & preparedInput,
137  InternalComplexImagePointerType & preparedKernel,
138  ProgressAccumulator * progress, float progressWeight);
139 
142  void PrepareInput(const InputImageType * input,
143  InternalComplexImagePointerType & preparedInput,
144  ProgressAccumulator * progress, float progressWeight);
145 
147  void PadInput(const InputImageType * input,
148  InternalImagePointerType & paddedInput,
149  ProgressAccumulator * progress, float progressWeight);
150 
152  void TransformPaddedInput(const InternalImageType * paddedInput,
153  InternalComplexImagePointerType & transformedInput,
154  ProgressAccumulator * progress, float progressWeight);
155 
159  void PrepareKernel(const KernelImageType * kernel,
160  InternalComplexImagePointerType & preparedKernel,
161  ProgressAccumulator * progress, float progressWeight);
162 
164  void ProduceOutput(InternalComplexImageType * paddedOutput,
165  ProgressAccumulator * progress,
166  float progressWeight);
167 
169  void CropOutput(InternalImageType * paddedOutput,
170  ProgressAccumulator * progress,
171  float progressWeight);
172 
179  InputSizeType GetPadLowerBound() const;
180 
182  InputSizeType GetPadSize() const;
183 
185  bool GetXDimensionIsOdd() const;
186 
187 private:
188  FFTConvolutionImageFilter(const Self &); //purposely not implemented
189  void operator=(const Self &); //purposely not implemented
190 };
191 }
192 
193 #ifndef ITK_MANUAL_INSTANTIATION
194 #include "itkFFTConvolutionImageFilter.hxx"
195 #endif
196 
197 #endif
198