ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTikhonovDeconvolutionImageFilter.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 itkTikhonovDeconvolutionImageFilter_h
19 #define itkTikhonovDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
49 template< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
50 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionImageFilter :
51  public InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision >
52 {
53 public:
55  typedef InverseDeconvolutionImageFilter< TInputImage,
56  TKernelImage,
57  TOutputImage,
58  TInternalPrecision > Superclass;
61 
63  itkNewMacro(Self);
64 
67 
69  itkStaticConstMacro(ImageDimension, unsigned int,
70  TInputImage::ImageDimension);
71 
72  typedef TInputImage InputImageType;
73  typedef TOutputImage OutputImageType;
74  typedef TKernelImage KernelImageType;
75  typedef typename Superclass::InputPixelType InputPixelType;
76  typedef typename Superclass::OutputPixelType OutputPixelType;
77  typedef typename Superclass::KernelPixelType KernelPixelType;
78  typedef typename Superclass::InputIndexType InputIndexType;
79  typedef typename Superclass::OutputIndexType OutputIndexType;
80  typedef typename Superclass::KernelIndexType KernelIndexType;
81  typedef typename Superclass::InputSizeType InputSizeType;
82  typedef typename Superclass::OutputSizeType OutputSizeType;
83  typedef typename Superclass::KernelSizeType KernelSizeType;
85  typedef typename Superclass::InputRegionType InputRegionType;
86  typedef typename Superclass::OutputRegionType OutputRegionType;
87  typedef typename Superclass::KernelRegionType KernelRegionType;
88 
90  typedef typename Superclass::InternalImageType InternalImageType;
91  typedef typename Superclass::InternalImagePointerType InternalImagePointerType;
92  typedef typename Superclass::InternalComplexType InternalComplexType;
93  typedef typename Superclass::InternalComplexImageType InternalComplexImageType;
94  typedef typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType;
95 
100  itkSetMacro(RegularizationConstant, double);
101  itkGetConstMacro(RegularizationConstant, double);
103 
104 protected:
107 
109  void GenerateData() ITK_OVERRIDE;
110 
111  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
112 
113 private:
114  ITK_DISALLOW_COPY_AND_ASSIGN(TikhonovDeconvolutionImageFilter);
115 
116  double m_RegularizationConstant;
117 };
118 
119 namespace Functor
120 {
121 template< typename TInput1, typename TInput2, typename TOutput >
122 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionFunctor
123 {
124 public:
125  TikhonovDeconvolutionFunctor() {m_RegularizationConstant = 0.0;}
127 
129  {
130  return false;
131  }
132  bool operator==( const TikhonovDeconvolutionFunctor & other) const
133  {
134  return !(*this != other);
135  }
136  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
137  {
138  typename TOutput::value_type normH = std::norm( H );
139  typename TOutput::value_type denominator = normH + m_RegularizationConstant;
140  TOutput value = NumericTraits< TOutput >::ZeroValue();
141  if ( denominator >= m_KernelZeroMagnitudeThreshold )
142  {
143  value = static_cast< TOutput >( I * ( std::conj( H ) / denominator ) );
144  }
145 
146  return value;
147  }
148 
151  void SetRegularizationConstant(double constant)
152  {
153  m_RegularizationConstant = constant;
154  }
156  {
157  return m_RegularizationConstant;
158  }
160 
164  {
165  m_KernelZeroMagnitudeThreshold = mu;
166  }
168  {
169  return m_KernelZeroMagnitudeThreshold;
170  }
172 
173 private:
176 };
177 } //namespace Functor
178 
179 }
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "itkTikhonovDeconvolutionImageFilter.hxx"
183 #endif
184 
185 #endif
Superclass::InternalImagePointerType InternalImagePointerType
An inverse deconvolution filter regularized in the Tikhonov sense.
Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
Superclass::InternalComplexImageType InternalComplexImageType
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
bool operator!=(const TikhonovDeconvolutionFunctor &) const
InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > Superclass
bool operator==(const TikhonovDeconvolutionFunctor &other) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutput operator()(const TInput1 &I, const TInput2 &H) const
The direct linear inverse deconvolution filter.