ITK  5.1.0
Insight Toolkit
itkParametricBlindLeastSquaresDeconvolutionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
25 
26 namespace itk
27 {
58 template <typename TInputImage, typename TKernelSource, typename TOutputImage = TInputImage>
60  : public IterativeDeconvolutionImageFilter<TInputImage, typename TKernelSource::OutputImageType, TOutputImage>
61 {
62 public:
63  ITK_DISALLOW_COPY_AND_ASSIGN(ParametricBlindLeastSquaresDeconvolutionImageFilter);
64 
67  using Superclass =
71 
73  using InputImageType = TInputImage;
74  using OutputImageType = TOutputImage;
75 
77  using InternalImageType = typename Superclass::InternalImageType;
78  using InternalImagePointerType = typename Superclass::InternalImagePointerType;
79  using InternalComplexType = typename Superclass::InternalComplexType;
80  using InternalComplexImageType = typename Superclass::InternalComplexImageType;
82 
84  using KernelSourceType = TKernelSource;
85  using KernelSourcePointer = typename KernelSourceType::Pointer;
86 
88  itkNewMacro(Self);
89 
92 
94  void
95  SetKernelSource(KernelSourceType * kernelSource);
96  itkGetModifiableObjectMacro(KernelSource, KernelSourceType);
98 
101  itkSetMacro(Alpha, double);
102  itkGetMacro(Alpha, double);
104 
107  itkSetMacro(Beta, double);
108  itkGetMacro(Beta, double);
110 
111 protected:
114 
115  void
116  Initialize(ProgressAccumulator * progress, float progressWeight, float iterationProgressWeight) override;
117 
118  void
119  Iteration(ProgressAccumulator * progress, float iterationProgressWeight) override;
120 
121  void
122  Finish(ProgressAccumulator * progress, float progressWeight) override;
123 
124  void
125  PrintSelf(std::ostream & os, Indent indent) const override;
126 
127 private:
128  template <typename TPixel>
130  {
131  public:
134 
135  bool
137  {
138  return false;
139  }
140 
141  bool
143  {
144  return !(*this != other);
145  }
146 
147  inline TPixel
148  operator()(const TPixel & estimateFT, const TPixel & kernelEstimateFT, const TPixel & inputFT)
149  {
150  return estimateFT * kernelEstimateFT - inputFT;
151  }
152  };
153 
154  template <typename TPixel>
156  {
157  public:
160 
161  bool
163  {
164  return false;
165  }
166 
167  bool
169  {
170  return !(*this != other);
171  }
172 
173  inline TPixel
174  operator()(const TPixel & estimateFT, const TPixel & differenceFT, const TPixel & kernelFT)
175  {
176  // Because of the linearity of the Fourier transform, we can
177  // perform the update step in the Fourier domain
178  return estimateFT - m_Alpha * (differenceFT * std::conj(kernelFT));
179  }
180 
181  void
182  SetAlpha(double alpha)
183  {
184  m_Alpha = alpha;
185  }
186  double
187  GetAlpha() const
188  {
189  return m_Alpha;
190  }
191 
192  private:
193  double m_Alpha{ 0.01 };
194  };
195 
197 
201  double m_Alpha;
202  double m_Beta;
203 
207 
217 
225 };
226 
227 } // end namespace itk
228 
229 #ifndef ITK_MANUAL_INSTANTIATION
230 # include "itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx"
231 #endif
232 
233 
234 #endif
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::InternalComplexImagePointerType
typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:81
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionDifference::operator==
bool operator==(const ParametricBlindLeastSquaresDeconvolutionDifference &other) const
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:142
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate::GetAlpha
double GetAlpha() const
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:187
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::KernelSourceType
TKernelSource KernelSourceType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:84
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_KernelSource
KernelSourcePointer m_KernelSource
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:196
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionDifference::operator!=
bool operator!=(const ParametricBlindLeastSquaresDeconvolutionDifference &) const
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:136
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_TransformedInput
InternalComplexImagePointerType m_TransformedInput
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:205
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::InternalImagePointerType
typename Superclass::InternalImagePointerType InternalImagePointerType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:78
itkTernaryFunctorImageFilter.h
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate::operator()
TPixel operator()(const TPixel &estimateFT, const TPixel &differenceFT, const TPixel &kernelFT)
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:174
itk::SmartPointer< Self >
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionDifference
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:129
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::InternalComplexType
typename Superclass::InternalComplexType InternalComplexType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:79
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:155
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::InternalImageType
typename Superclass::InternalImageType InternalImageType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:77
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionDifference::operator()
TPixel operator()(const TPixel &estimateFT, const TPixel &kernelEstimateFT, const TPixel &inputFT)
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:148
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::InternalComplexImageType
typename Superclass::InternalComplexImageType InternalComplexImageType
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:80
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::IterativeDeconvolutionImageFilter::InternalComplexImagePointerType
typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType
Definition: itkIterativeDeconvolutionImageFilter.h:77
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate::SetAlpha
void SetAlpha(double alpha)
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:182
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate::operator!=
bool operator!=(const ParametricBlindLeastSquaresDeconvolutionImageUpdate &) const
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:162
itk::TernaryFunctorImageFilter
Implements pixel-wise generic operation of three images.
Definition: itkTernaryFunctorImageFilter.h:43
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter
Least-squares blind deconvolution filter that also estimates the parameters of a user-supplied parame...
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:59
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::KernelSourcePointer
typename KernelSourceType::Pointer KernelSourcePointer
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:85
itk::ProgressAccumulator
Facilitates progress reporting for filters that wrap around multiple other filters.
Definition: itkProgressAccumulator.h:40
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_Beta
double m_Beta
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:202
itkIterativeDeconvolutionImageFilter.h
itk::IterativeDeconvolutionImageFilter
Abstract base class for filters that implement iterative deconvolution algorithms.
Definition: itkIterativeDeconvolutionImageFilter.h:55
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::ParametricBlindLeastSquaresDeconvolutionImageUpdate::operator==
bool operator==(const ParametricBlindLeastSquaresDeconvolutionImageUpdate &other) const
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:168
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_ImageUpdateFilter
ImageUpdateFilterType::Pointer m_ImageUpdateFilter
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:224
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itkParametricImageSource.h
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_Alpha
double m_Alpha
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:201
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_DifferenceFilter
DifferenceFilterType::Pointer m_DifferenceFilter
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:216
itk::ParametricBlindLeastSquaresDeconvolutionImageFilter::m_TransformedCurrentEstimate
InternalComplexImagePointerType m_TransformedCurrentEstimate
Definition: itkParametricBlindLeastSquaresDeconvolutionImageFilter.h:206
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90