ITK  5.2.0
Insight Toolkit
itkTikhonovDeconvolutionImageFilter.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 itkTikhonovDeconvolutionImageFilter_h
19 #define itkTikhonovDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
50 template <typename TInputImage,
51  typename TKernelImage = TInputImage,
52  typename TOutputImage = TInputImage,
53  typename TInternalPrecision = double>
54 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionImageFilter
55  : public InverseDeconvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrecision>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(TikhonovDeconvolutionImageFilter);
60 
65 
67  itkNewMacro(Self);
68 
71 
73  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
74 
75  using InputImageType = TInputImage;
76  using OutputImageType = TOutputImage;
77  using KernelImageType = TKernelImage;
78  using InputPixelType = typename Superclass::InputPixelType;
79  using OutputPixelType = typename Superclass::OutputPixelType;
80  using KernelPixelType = typename Superclass::KernelPixelType;
81  using InputIndexType = typename Superclass::InputIndexType;
82  using OutputIndexType = typename Superclass::OutputIndexType;
83  using KernelIndexType = typename Superclass::KernelIndexType;
84  using InputSizeType = typename Superclass::InputSizeType;
85  using OutputSizeType = typename Superclass::OutputSizeType;
86  using KernelSizeType = typename Superclass::KernelSizeType;
88  using InputRegionType = typename Superclass::InputRegionType;
89  using OutputRegionType = typename Superclass::OutputRegionType;
90  using KernelRegionType = typename Superclass::KernelRegionType;
91 
93  using InternalImageType = typename Superclass::InternalImageType;
94  using InternalImagePointerType = typename Superclass::InternalImagePointerType;
95  using InternalComplexType = typename Superclass::InternalComplexType;
96  using InternalComplexImageType = typename Superclass::InternalComplexImageType;
97  using InternalComplexImagePointerType = typename Superclass::InternalComplexImagePointerType;
98 
103  itkSetMacro(RegularizationConstant, double);
104  itkGetConstMacro(RegularizationConstant, double);
106 
107 protected:
109  ~TikhonovDeconvolutionImageFilter() override = default;
110 
112  void
113  GenerateData() override;
114 
115  void
116  PrintSelf(std::ostream & os, Indent indent) const override;
117 
118 private:
120 };
121 
122 namespace Functor
123 {
124 template <typename TInput1, typename TInput2, typename TOutput>
125 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionFunctor
126 {
127 public:
128  TikhonovDeconvolutionFunctor() = default;
129  ~TikhonovDeconvolutionFunctor() = default;
131  : m_RegularizationConstant(f.m_RegularizationConstant)
132  , m_KernelZeroMagnitudeThreshold(f.m_KernelZeroMagnitudeThreshold)
133  {}
134 
135 
136  bool
138  {
139  return false;
140  }
141  bool
143  {
144  return !(*this != other);
145  }
146  inline TOutput
147  operator()(const TInput1 & I, const TInput2 & H) const
148  {
149  typename TOutput::value_type normH = std::norm(H);
150  typename TOutput::value_type denominator = normH + m_RegularizationConstant;
151  TOutput value = NumericTraits<TOutput>::ZeroValue();
152  if (denominator >= m_KernelZeroMagnitudeThreshold)
153  {
154  value = static_cast<TOutput>(I * (std::conj(H) / denominator));
155  }
156 
157  return value;
158  }
159 
162  void
163  SetRegularizationConstant(double constant)
164  {
165  m_RegularizationConstant = constant;
166  }
167  double
169  {
170  return m_RegularizationConstant;
171  }
173 
176  void
178  {
179  m_KernelZeroMagnitudeThreshold = mu;
180  }
181  double
183  {
184  return m_KernelZeroMagnitudeThreshold;
185  }
187 
188 private:
189  double m_RegularizationConstant = 0.0;
190  double m_KernelZeroMagnitudeThreshold = 0.0;
191 };
192 } // namespace Functor
193 
194 } // namespace itk
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 # include "itkTikhonovDeconvolutionImageFilter.hxx"
198 #endif
199 
200 #endif
itkInverseDeconvolutionImageFilter.h
itk::ConvolutionImageFilterBase::OutputRegionType
typename OutputImageType::RegionType OutputRegionType
Definition: itkConvolutionImageFilterBase.h:88
itk::ConvolutionImageFilterBase::KernelImageType
TKernelImage KernelImageType
Definition: itkConvolutionImageFilterBase.h:76
itk::ConvolutionImageFilterBase::SizeValueType
typename InputSizeType::SizeValueType SizeValueType
Definition: itkConvolutionImageFilterBase.h:86
itk::TikhonovDeconvolutionImageFilter
An inverse deconvolution filter regularized in the Tikhonov sense.
Definition: itkTikhonovDeconvolutionImageFilter.h:54
itk::Functor::TikhonovDeconvolutionFunctor::SetKernelZeroMagnitudeThreshold
void SetKernelZeroMagnitudeThreshold(double mu)
Definition: itkTikhonovDeconvolutionImageFilter.h:177
itk::ConvolutionImageFilterBase::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkConvolutionImageFilterBase.h:81
itk::ConvolutionImageFilterBase::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkConvolutionImageFilterBase.h:80
itk::Functor::TikhonovDeconvolutionFunctor::TikhonovDeconvolutionFunctor
TikhonovDeconvolutionFunctor(const TikhonovDeconvolutionFunctor &f)
Definition: itkTikhonovDeconvolutionImageFilter.h:130
itk::ConvolutionImageFilterBase::KernelPixelType
typename KernelImageType::PixelType KernelPixelType
Definition: itkConvolutionImageFilterBase.h:79
itk::Functor::TikhonovDeconvolutionFunctor::operator()
TOutput operator()(const TInput1 &I, const TInput2 &H) const
Definition: itkTikhonovDeconvolutionImageFilter.h:147
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ConvolutionImageFilterBase::OutputSizeType
typename OutputImageType::SizeType OutputSizeType
Definition: itkConvolutionImageFilterBase.h:84
itk::ConvolutionImageFilterBase::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkConvolutionImageFilterBase.h:77
itk::FFTConvolutionImageFilter::InternalComplexImagePointerType
typename InternalComplexImageType::Pointer InternalComplexImagePointerType
Definition: itkFFTConvolutionImageFilter.h:101
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::InverseDeconvolutionImageFilter
The direct linear inverse deconvolution filter.
Definition: itkInverseDeconvolutionImageFilter.h:58
itk::FFTConvolutionImageFilter::InternalComplexType
std::complex< TInternalPrecision > InternalComplexType
Definition: itkFFTConvolutionImageFilter.h:99
itk::Functor::TikhonovDeconvolutionFunctor::GetKernelZeroMagnitudeThreshold
double GetKernelZeroMagnitudeThreshold() const
Definition: itkTikhonovDeconvolutionImageFilter.h:182
itk::ConvolutionImageFilterBase::KernelIndexType
typename KernelImageType::IndexType KernelIndexType
Definition: itkConvolutionImageFilterBase.h:82
itk::TikhonovDeconvolutionImageFilter::m_RegularizationConstant
double m_RegularizationConstant
Definition: itkTikhonovDeconvolutionImageFilter.h:119
itk::Functor::TikhonovDeconvolutionFunctor
Definition: itkTikhonovDeconvolutionImageFilter.h:125
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::Functor::TikhonovDeconvolutionFunctor::operator==
bool operator==(const TikhonovDeconvolutionFunctor &other) const
Definition: itkTikhonovDeconvolutionImageFilter.h:142
itk::Functor::TikhonovDeconvolutionFunctor::GetRegularizationConstant
double GetRegularizationConstant() const
Definition: itkTikhonovDeconvolutionImageFilter.h:168
itk::ConvolutionImageFilterBase::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkConvolutionImageFilterBase.h:78
itk::Functor::TikhonovDeconvolutionFunctor::operator!=
bool operator!=(const TikhonovDeconvolutionFunctor &) const
Definition: itkTikhonovDeconvolutionImageFilter.h:137
itk::NumericTraits::ZeroValue
static T ZeroValue()
Definition: itkNumericTraits.h:148
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ConvolutionImageFilterBase::InputRegionType
typename InputImageType::RegionType InputRegionType
Definition: itkConvolutionImageFilterBase.h:87
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::ConvolutionImageFilterBase::InputSizeType
typename InputImageType::SizeType InputSizeType
Definition: itkConvolutionImageFilterBase.h:83
itk::ConvolutionImageFilterBase::KernelRegionType
typename KernelImageType::RegionType KernelRegionType
Definition: itkConvolutionImageFilterBase.h:89
itk::Functor::TikhonovDeconvolutionFunctor::SetRegularizationConstant
void SetRegularizationConstant(double constant)
Definition: itkTikhonovDeconvolutionImageFilter.h:163
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::FFTConvolutionImageFilter::InternalImagePointerType
typename InternalImageType::Pointer InternalImagePointerType
Definition: itkFFTConvolutionImageFilter.h:98
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::ConvolutionImageFilterBase::KernelSizeType
typename KernelImageType::SizeType KernelSizeType
Definition: itkConvolutionImageFilterBase.h:85