ITK  5.3.0
Insight Toolkit
itkInverseDeconvolutionImageFilter.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 itkInverseDeconvolutionImageFilter_h
19 #define itkInverseDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
54 template <typename TInputImage,
55  typename TKernelImage = TInputImage,
56  typename TOutputImage = TInputImage,
57  typename TInternalPrecision = double>
58 class ITK_TEMPLATE_EXPORT InverseDeconvolutionImageFilter
59  : public FFTConvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrecision>
60 {
61 public:
62  ITK_DISALLOW_COPY_AND_MOVE(InverseDeconvolutionImageFilter);
64 
69 
71  itkNewMacro(Self);
72 
75 
77  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
78 
79  using InputImageType = TInputImage;
80  using OutputImageType = TOutputImage;
81  using KernelImageType = TKernelImage;
82  using typename Superclass::InputPixelType;
83  using typename Superclass::OutputPixelType;
84  using typename Superclass::KernelPixelType;
85  using typename Superclass::InputIndexType;
86  using typename Superclass::OutputIndexType;
87  using typename Superclass::KernelIndexType;
88  using typename Superclass::InputSizeType;
89  using typename Superclass::OutputSizeType;
90  using typename Superclass::KernelSizeType;
91  using typename Superclass::SizeValueType;
92  using typename Superclass::InputRegionType;
93  using typename Superclass::OutputRegionType;
94  using typename Superclass::KernelRegionType;
95 
97  using typename Superclass::InternalImageType;
98  using typename Superclass::InternalImagePointerType;
99  using typename Superclass::InternalComplexType;
100  using typename Superclass::InternalComplexImageType;
101  using typename Superclass::InternalComplexImagePointerType;
102 
106  itkSetMacro(KernelZeroMagnitudeThreshold, double);
107  itkGetConstMacro(KernelZeroMagnitudeThreshold, double);
109 
110 protected:
112  ~InverseDeconvolutionImageFilter() override = default;
113 
115  void
116  GenerateData() override;
117 
118  void
119  PrintSelf(std::ostream & os, Indent indent) const override;
120 
121 private:
123 };
124 
125 namespace Functor
126 {
127 template <typename TInput1, typename TInput2, typename TOutput>
128 class ITK_TEMPLATE_EXPORT InverseDeconvolutionFunctor
129 {
130 public:
131  InverseDeconvolutionFunctor() { m_KernelZeroMagnitudeThreshold = 0.0; }
132  ~InverseDeconvolutionFunctor() = default;
133 
134  bool
136  {
137  return true;
138  }
139 
140  ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(InverseDeconvolutionFunctor);
141 
142  inline TOutput
143  operator()(const TInput1 & I, const TInput2 & H) const
144  {
145  const double absH = std::abs(H);
146  TOutput value = NumericTraits<TOutput>::ZeroValue();
147  if (absH >= m_KernelZeroMagnitudeThreshold)
148  {
149  value = static_cast<TOutput>(I / H);
150  }
151  return value;
152  }
153 
156  void
158  {
159  m_KernelZeroMagnitudeThreshold = mu;
160  }
161  double
163  {
164  return m_KernelZeroMagnitudeThreshold;
165  }
167 
168 private:
170 };
171 } // namespace Functor
172 
173 } // namespace itk
174 
175 #ifndef ITK_MANUAL_INSTANTIATION
176 # include "itkInverseDeconvolutionImageFilter.hxx"
177 #endif
178 
179 #endif
itk::Functor::InverseDeconvolutionFunctor::InverseDeconvolutionFunctor
InverseDeconvolutionFunctor()
Definition: itkInverseDeconvolutionImageFilter.h:131
itk::FFTConvolutionImageFilter
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain.
Definition: itkFFTConvolutionImageFilter.h:58
itk::Functor::InverseDeconvolutionFunctor::operator()
TOutput operator()(const TInput1 &I, const TInput2 &H) const
Definition: itkInverseDeconvolutionImageFilter.h:143
itk::ConvolutionImageFilterBase::KernelImageType
TKernelImage KernelImageType
Definition: itkConvolutionImageFilterBase.h:76
itk::Functor::InverseDeconvolutionFunctor::GetKernelZeroMagnitudeThreshold
double GetKernelZeroMagnitudeThreshold() const
Definition: itkInverseDeconvolutionImageFilter.h:162
itkFFTConvolutionImageFilter.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::InverseDeconvolutionFunctor::m_KernelZeroMagnitudeThreshold
double m_KernelZeroMagnitudeThreshold
Definition: itkInverseDeconvolutionImageFilter.h:169
itk::InverseDeconvolutionImageFilter
The direct linear inverse deconvolution filter.
Definition: itkInverseDeconvolutionImageFilter.h:58
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::Functor::InverseDeconvolutionFunctor::operator==
bool operator==(const InverseDeconvolutionFunctor &) const
Definition: itkInverseDeconvolutionImageFilter.h:135
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::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Functor::InverseDeconvolutionFunctor
Definition: itkInverseDeconvolutionImageFilter.h:128
itk::Functor::InverseDeconvolutionFunctor::SetKernelZeroMagnitudeThreshold
void SetKernelZeroMagnitudeThreshold(double mu)
Definition: itkInverseDeconvolutionImageFilter.h:157
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::InverseDeconvolutionImageFilter::m_KernelZeroMagnitudeThreshold
double m_KernelZeroMagnitudeThreshold
Definition: itkInverseDeconvolutionImageFilter.h:122