ITK  6.0.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 * https://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#include "itkMath.h"
23
24namespace itk
25{
55template <typename TInputImage,
56 typename TKernelImage = TInputImage,
57 typename TOutputImage = TInputImage,
58 typename TInternalPrecision = double>
59class ITK_TEMPLATE_EXPORT InverseDeconvolutionImageFilter
60 : public FFTConvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrecision>
61{
62public:
63 ITK_DISALLOW_COPY_AND_MOVE(InverseDeconvolutionImageFilter);
70
72 itkNewMacro(Self);
73
75 itkOverrideGetNameOfClassMacro(InverseDeconvolutionImageFilter);
76
78 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
79
80 using InputImageType = TInputImage;
81 using OutputImageType = TOutputImage;
82 using KernelImageType = TKernelImage;
83 using typename Superclass::InputPixelType;
84 using typename Superclass::OutputPixelType;
85 using typename Superclass::KernelPixelType;
86 using typename Superclass::InputIndexType;
87 using typename Superclass::OutputIndexType;
88 using typename Superclass::KernelIndexType;
89 using typename Superclass::InputSizeType;
90 using typename Superclass::OutputSizeType;
91 using typename Superclass::KernelSizeType;
92 using typename Superclass::SizeValueType;
93 using typename Superclass::InputRegionType;
94 using typename Superclass::OutputRegionType;
95 using typename Superclass::KernelRegionType;
96
98 using typename Superclass::InternalImageType;
99 using typename Superclass::InternalImagePointerType;
100 using typename Superclass::InternalComplexType;
101 using typename Superclass::InternalComplexImageType;
102 using typename Superclass::InternalComplexImagePointerType;
103
107 itkSetMacro(KernelZeroMagnitudeThreshold, double);
108 itkGetConstMacro(KernelZeroMagnitudeThreshold, double);
111protected:
114
116 void
117 GenerateData() override;
118
119 void
120 PrintSelf(std::ostream & os, Indent indent) const override;
121
122private:
123 double m_KernelZeroMagnitudeThreshold{};
124};
125
126namespace Functor
127{
128template <typename TInput1, typename TInput2, typename TOutput>
129class ITK_TEMPLATE_EXPORT InverseDeconvolutionFunctor
130{
131public:
132 InverseDeconvolutionFunctor() { m_KernelZeroMagnitudeThreshold = 0.0; }
134
135 bool
137 {
138 return true;
139 }
140
142
143 inline TOutput
144 operator()(const TInput1 & I, const TInput2 & H) const
145 {
146 const double absH = itk::Math::abs(H);
147 TOutput value{};
148 if (absH >= m_KernelZeroMagnitudeThreshold)
149 {
150 value = static_cast<TOutput>(I / H);
151 }
152 return value;
153 }
154
157 void
159 {
160 m_KernelZeroMagnitudeThreshold = mu;
161 }
162 double
164 {
165 return m_KernelZeroMagnitudeThreshold;
166 }
169private:
171};
172} // namespace Functor
173
174} // namespace itk
175
176#ifndef ITK_MANUAL_INSTANTIATION
177# include "itkInverseDeconvolutionImageFilter.hxx"
178#endif
179
180#endif
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain.
TOutput operator()(const TInput1 &I, const TInput2 &H) const
bool operator==(const InverseDeconvolutionFunctor &) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(InverseDeconvolutionFunctor)
Control indentation during Print() invocation.
Definition: itkIndent.h:50
The direct linear inverse deconvolution filter.
~InverseDeconvolutionImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
bool abs(bool x)
Definition: itkMath.h:844
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:86