ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkParametricBlindLeastSquaresDeconvolutionImageFilter.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 __itkParametricBlindLeastSquaresDeconvolutionImageFilter_h
19 #define __itkParametricBlindLeastSquaresDeconvolutionImageFilter_h
20 
22 
26 
27 namespace itk
28 {
58 template< class TInputImage, class TKernelSource, class TOutputImage=TInputImage >
60  public IterativeDeconvolutionImageFilter< TInputImage, typename TKernelSource::OutputImageType, TOutputImage >
61 {
62 public:
65  typedef IterativeDeconvolutionImageFilter< TInputImage,
66  typename TKernelSource::OutputImageType,
67  TOutputImage > Superclass;
70 
72  typedef TInputImage InputImageType;
73  typedef TOutputImage OutputImageType;
74 
76  typedef typename Superclass::InternalImageType InternalImageType;
77  typedef typename Superclass::InternalImagePointerType InternalImagePointerType;
78  typedef typename Superclass::InternalComplexType InternalComplexType;
79  typedef typename Superclass::InternalComplexImageType InternalComplexImageType;
80  typedef typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType;
81 
83  typedef TKernelSource KernelSourceType;
84  typedef typename KernelSourceType::Pointer KernelSourcePointer;
85 
87  itkNewMacro(Self);
88 
92 
94  void SetKernelSource(KernelSourceType * kernelSource);
95  itkGetModifiableObjectMacro(KernelSource, KernelSourceType);
97 
100  itkSetMacro(Alpha, double);
101  itkGetMacro(Alpha, double);
103 
106  itkSetMacro(Beta, double);
107  itkGetMacro(Beta, double);
109 
110 protected:
113 
114  virtual void Initialize(ProgressAccumulator * progress,
115  float progressWeight,
116  float iterationProgressWeight);
117 
118  virtual void Iteration(ProgressAccumulator * progress,
119  float iterationProgressWeight);
120 
121  virtual void Finish(ProgressAccumulator *progress, float progressWeight);
122 
123  virtual void PrintSelf(std::ostream & os, Indent indent) const;
124 
125 private:
126  ParametricBlindLeastSquaresDeconvolutionImageFilter(const Self &); // purposely not implemented
127  void operator=(const Self &); // purposely not implemented
128 
129  template< class TPixel >
131  {
132  public:
135 
137  {
138  return false;
139  }
140 
141  bool operator==(const ParametricBlindLeastSquaresDeconvolutionDifference & other) const
142  {
143  return !( *this != other );
144  }
145 
146  inline TPixel operator()(const TPixel & estimateFT,
147  const TPixel & kernelEstimateFT,
148  const TPixel & inputFT)
149  {
150  return estimateFT * kernelEstimateFT - inputFT;
151  }
152  };
153 
154  template< class TPixel >
156  {
157  public:
160 
162  {
163  return false;
164  }
165 
166  bool operator==(const ParametricBlindLeastSquaresDeconvolutionImageUpdate & other) const
167  {
168  return !( *this != other );
169  }
170 
171  inline TPixel operator()(const TPixel & estimateFT,
172  const TPixel & differenceFT,
173  const TPixel & kernelFT)
174  {
175  // Because of the linearity of the Fourier transform, we can
176  // perform the update step in the Fourier domain
177  return estimateFT - m_Alpha * ( differenceFT * std::conj( kernelFT ) );
178  }
179 
180  void SetAlpha(double alpha)
181  {
182  m_Alpha = alpha;
183  }
184  double GetAlpha() const
185  {
186  return m_Alpha;
187  }
188 
189  private:
190  double m_Alpha;
191  };
192 
194 
198  double m_Alpha;
199  double m_Beta;
200 
204 
216 
226 
227 };
228 
229 } // end namespace itk
230 
231 #ifndef ITK_MANUAL_INSTANTIATION
232 #include "itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx"
233 #endif
234 
235 
236 #endif
237