ITK  4.13.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< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
54 class ITK_TEMPLATE_EXPORT InverseDeconvolutionImageFilter :
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  virtual void GenerateData() ITK_OVERRIDE;
113 
114  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
115 
116 private:
117  ITK_DISALLOW_COPY_AND_ASSIGN(InverseDeconvolutionImageFilter);
118 
119  double m_KernelZeroMagnitudeThreshold;
120 };
121 
122 namespace Functor
123 {
124 template< typename TInput1, typename TInput2, typename TOutput >
125 class ITK_TEMPLATE_EXPORT InverseDeconvolutionFunctor
126 {
127 public:
128  InverseDeconvolutionFunctor() { m_KernelZeroMagnitudeThreshold = 0.0; }
130 
132  {
133  return false;
134  }
135  bool operator==( const InverseDeconvolutionFunctor & other) const
136  {
137  return !(*this != other);
138  }
139  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
140  {
141  const double absH = std::abs( H );
142  TOutput value = NumericTraits< TOutput >::ZeroValue();
143  if ( absH >= m_KernelZeroMagnitudeThreshold )
144  {
145  value = static_cast< TOutput >( I / H );
146  }
147  return value;
148  }
149 
153  {
154  m_KernelZeroMagnitudeThreshold = mu;
155  }
157  {
158  return m_KernelZeroMagnitudeThreshold;
159  }
161 
162 private:
164 };
165 } //namespace Functor
166 
167 }
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 #include "itkInverseDeconvolutionImageFilter.hxx"
171 #endif
172 
173 #endif
TOutput operator()(const TInput1 &I, const TInput2 &H) const
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain...
bool operator!=(const InverseDeconvolutionFunctor &) const
FFTConvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > Superclass
Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
bool operator==(const InverseDeconvolutionFunctor &other) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::InternalImagePointerType InternalImagePointerType
The direct linear inverse deconvolution filter.
bool abs(const bool x)
Definition: itkMath.h:806
Superclass::InternalComplexImageType InternalComplexImageType