ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkWienerDeconvolutionImageFilter.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 itkWienerDeconvolutionImageFilter_h
19 #define itkWienerDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
74 template< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
76  public InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision >
77 {
78 public:
80  typedef InverseDeconvolutionImageFilter< TInputImage,
81  TKernelImage,
82  TOutputImage,
83  TInternalPrecision > Superclass;
86 
88  itkNewMacro(Self);
89 
92 
94  itkStaticConstMacro(ImageDimension, unsigned int,
95  TInputImage::ImageDimension);
96 
97  typedef TInputImage InputImageType;
98  typedef TOutputImage OutputImageType;
99  typedef TKernelImage KernelImageType;
113 
120 
123  itkSetMacro(NoiseVariance, double);
124  itkGetConstMacro(NoiseVariance, double);
126 
127 protected:
130 
132  void GenerateData() ITK_OVERRIDE;
133 
134  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
135 
136 private:
137  WienerDeconvolutionImageFilter(const Self &); //purposely not implemented
138  void operator=(const Self &); //purposely not implemented
139 
141 };
142 
143 namespace Functor
144 {
145 template< typename TPixel >
147 {
148 public:
151 
153  {
154  return false;
155  }
156  bool operator==( const WienerDeconvolutionFunctor & other) const
157  {
158  return !(*this != other);
159  }
160  inline TPixel operator()(const TPixel & I, const TPixel & H) const
161  {
162  TPixel Pn = m_NoisePowerSpectralDensityConstant;
163 
164  // We estimate the power spectral density of the output image to
165  // be the same as the power spectral density of the blurred input
166  // minus the power spectral density of the noise.
167  TPixel Pf = std::norm( I );
168 
169  TPixel denominator = std::norm( H ) + ( Pn / (Pf - Pn) );
170  TPixel value = NumericTraits< TPixel >::ZeroValue();
171  if ( std::abs( denominator ) >= m_KernelZeroMagnitudeThreshold )
172  {
173  value = I * ( std::conj( H ) / denominator );
174  }
175 
176  return value;
177  }
178 
182  {
183  m_NoisePowerSpectralDensityConstant = constant;
184  }
186  {
187  return m_NoisePowerSpectralDensityConstant;
188  }
190 
194  {
196  }
198  {
200  }
202 
203 private:
206 };
207 } //namespace Functor
208 
209 }
210 
211 #ifndef ITK_MANUAL_INSTANTIATION
212 #include "itkWienerDeconvolutionImageFilter.hxx"
213 #endif
214 
215 #endif
TPixel operator()(const TPixel &I, const TPixel &H) const
Superclass::InternalComplexImageType InternalComplexImageType
The Wiener deconvolution image filter is designed to restore an image convolved with a blurring kerne...
Base class for all process objects that output image data.
Superclass::InternalImagePointerType InternalImagePointerType
bool operator!=(const WienerDeconvolutionFunctor &) const
bool operator==(const WienerDeconvolutionFunctor &other) const
InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > Superclass
Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::InternalImagePointerType InternalImagePointerType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
The direct linear inverse deconvolution filter.
Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
Superclass::InternalComplexImageType InternalComplexImageType