ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkInverseDeconvolutionImageFilter.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 __itkInverseDeconvolutionImageFilter_h
19 #define __itkInverseDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
53 template< class TInputImage, class TKernelImage = TInputImage, class TOutputImage = TInputImage, class TInternalPrecision=double >
55  public FFTConvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision >
56 {
57 public:
59  typedef FFTConvolutionImageFilter< TInputImage,
60  TKernelImage,
61  TOutputImage,
62  TInternalPrecision > Superclass;
65 
67  itkNewMacro(Self);
68 
71 
73  itkStaticConstMacro(ImageDimension, unsigned int,
74  TInputImage::ImageDimension);
75 
76  typedef TInputImage InputImageType;
77  typedef TOutputImage OutputImageType;
78  typedef TKernelImage KernelImageType;
79  typedef typename Superclass::InputPixelType InputPixelType;
80  typedef typename Superclass::OutputPixelType OutputPixelType;
81  typedef typename Superclass::KernelPixelType KernelPixelType;
82  typedef typename Superclass::InputIndexType InputIndexType;
83  typedef typename Superclass::OutputIndexType OutputIndexType;
84  typedef typename Superclass::KernelIndexType KernelIndexType;
85  typedef typename Superclass::InputSizeType InputSizeType;
86  typedef typename Superclass::OutputSizeType OutputSizeType;
87  typedef typename Superclass::KernelSizeType KernelSizeType;
89  typedef typename Superclass::InputRegionType InputRegionType;
90  typedef typename Superclass::OutputRegionType OutputRegionType;
91  typedef typename Superclass::KernelRegionType KernelRegionType;
92 
94  typedef typename Superclass::InternalImageType InternalImageType;
95  typedef typename Superclass::InternalImagePointerType InternalImagePointerType;
96  typedef typename Superclass::InternalComplexType InternalComplexType;
97  typedef typename Superclass::InternalComplexImageType InternalComplexImageType;
98  typedef typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType;
99 
103  itkSetMacro(KernelZeroMagnitudeThreshold, double);
104  itkGetConstMacro(KernelZeroMagnitudeThreshold, double);
106 
107 protected:
110 
112  void GenerateData();
113 
114  virtual void PrintSelf(std::ostream & os, Indent indent) const;
115 
116 private:
117  InverseDeconvolutionImageFilter(const Self &); //purposely not implemented
118  void operator=(const Self &); //purposely not implemented
119 
121 };
122 
123 namespace Functor
124 {
125 template< class TInput1, class TInput2, class TOutput >
127 {
128 public:
131 
133  {
134  return false;
135  }
136  bool operator==( const InverseDeconvolutionFunctor & other) const
137  {
138  return !(*this != other);
139  }
140  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
141  {
142  double absH = std::abs( H );
143  TOutput value = NumericTraits< TOutput >::ZeroValue();
144  if ( absH >= m_KernelZeroMagnitudeThreshold )
145  {
146  value = static_cast< TOutput >( I / H );
147  }
148  return value;
149  }
150 
154  {
156  }
158  {
160  }
162 
163 private:
165 };
166 } //namespace Functor
167 
168 }
169 
170 #ifndef ITK_MANUAL_INSTANTIATION
171 #include "itkInverseDeconvolutionImageFilter.hxx"
172 #endif
173 
174 #endif
175