ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkFFTConvolutionImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkFFTConvolutionImageFilter_h
00019 #define __itkFFTConvolutionImageFilter_h
00020 
00021 #include "itkConvolutionImageFilterBase.h"
00022 
00023 #include "itkProgressAccumulator.h"
00024 #include "itkZeroFluxNeumannBoundaryCondition.h"
00025 
00026 namespace itk
00027 {
00051 template< class TInputImage, class TKernelImage = TInputImage, class TOutputImage = TInputImage, class TInternalPrecision=double >
00052 class ITK_EXPORT FFTConvolutionImageFilter :
00053   public ConvolutionImageFilterBase< TInputImage, TKernelImage, TOutputImage >
00054 
00055 {
00056 public:
00057   typedef FFTConvolutionImageFilter                       Self;
00058   typedef ConvolutionImageFilterBase< TInputImage,
00059                                       TKernelImage,
00060                                       TOutputImage >
00061                                                           Superclass;
00062   typedef SmartPointer< Self >                            Pointer;
00063   typedef SmartPointer< const Self >                      ConstPointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro(FFTConvolutionImageFilter, ConvolutionImageFilterBase);
00070 
00072   itkStaticConstMacro(ImageDimension, unsigned int,
00073                       TInputImage::ImageDimension);
00074 
00075   typedef TInputImage                           InputImageType;
00076   typedef TOutputImage                          OutputImageType;
00077   typedef TKernelImage                          KernelImageType;
00078   typedef typename InputImageType::PixelType    InputPixelType;
00079   typedef typename OutputImageType::PixelType   OutputPixelType;
00080   typedef typename KernelImageType::PixelType   KernelPixelType;
00081   typedef typename InputImageType::IndexType    InputIndexType;
00082   typedef typename OutputImageType::IndexType   OutputIndexType;
00083   typedef typename KernelImageType::IndexType   KernelIndexType;
00084   typedef typename InputImageType::SizeType     InputSizeType;
00085   typedef typename OutputImageType::SizeType    OutputSizeType;
00086   typedef typename KernelImageType::SizeType    KernelSizeType;
00087   typedef typename InputSizeType::SizeValueType SizeValueType;
00088   typedef typename InputImageType::RegionType   InputRegionType;
00089   typedef typename OutputImageType::RegionType  OutputRegionType;
00090   typedef typename KernelImageType::RegionType  KernelRegionType;
00091 
00093   typedef Image< TInternalPrecision, TInputImage::ImageDimension >  InternalImageType;
00094   typedef typename InternalImageType::Pointer                       InternalImagePointerType;
00095   typedef std::complex< TInternalPrecision >                        InternalComplexType;
00096   typedef Image< InternalComplexType, TInputImage::ImageDimension > InternalComplexImageType;
00097   typedef typename InternalComplexImageType::Pointer                InternalComplexImagePointerType;
00098 
00100   typedef typename Superclass::BoundaryConditionType        BoundaryConditionType;
00101   typedef typename Superclass::BoundaryConditionPointerType BoundaryConditionPointerType;
00102 
00103 protected:
00104   FFTConvolutionImageFilter();
00105   ~FFTConvolutionImageFilter() {}
00106 
00114   void GenerateInputRequestedRegion();
00115 
00117   void GenerateData();
00118 
00123   void PrepareInputs(InternalComplexImagePointerType & preparedInput,
00124                      InternalComplexImagePointerType & preparedKernel,
00125                      ProgressAccumulator * progress,
00126                      float progressWeight);
00127 
00129   void ProduceOutput(InternalComplexImageType * paddedOutput,
00130                      ProgressAccumulator * progress,
00131                      float progressWeight);
00132 
00134   InputSizeType GetPadSize() const;
00135 
00137   bool GetXDimensionIsOdd() const;
00138 
00139 private:
00140   FFTConvolutionImageFilter(const Self &); //purposely not implemented
00141   void operator=(const Self &);         //purposely not implemented
00142 };
00143 }
00144 
00145 #ifndef ITK_MANUAL_INSTANTIATION
00146 #include "itkFFTConvolutionImageFilter.hxx"
00147 #endif
00148 
00149 #endif
00150