ITK  4.3.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< class TInputImage, class TKernelImage = TInputImage, class TOutputImage = TInputImage, class TInternalPrecision=double >
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();
110 
111  virtual void PrintSelf(std::ostream & os, Indent indent) const;
112 
113 private:
114  TikhonovDeconvolutionImageFilter(const Self &); //purposely not implemented
115  void operator=(const Self &); //purposely not implemented
116 
118 };
119 
120 namespace Functor
121 {
122 template< class TInput1, class TInput2, class TOutput >
124 {
125 public:
128 
130  {
131  return false;
132  }
133  bool operator==( const TikhonovDeconvolutionFunctor & other) const
134  {
135  return !(*this != other);
136  }
137  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
138  {
139  typename TOutput::value_type normH = std::norm( H );
140  typename TOutput::value_type denominator = normH + m_RegularizationConstant;
141  TOutput value = NumericTraits< TOutput >::ZeroValue();
142  if ( denominator >= m_KernelZeroMagnitudeThreshold )
143  {
144  value = static_cast< TOutput >( I * ( std::conj( H ) / denominator ) );
145  }
146 
147  return value;
148  }
149 
152  void SetRegularizationConstant(double constant)
153  {
154  m_RegularizationConstant = constant;
155  }
157  {
159  }
161 
165  {
167  }
169  {
171  }
173 
174 private:
177 };
178 } //namespace Functor
179 
180 }
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 #include "itkTikhonovDeconvolutionImageFilter.hxx"
184 #endif
185 
186 #endif
187