ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
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 * 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 itkTikhonovDeconvolutionImageFilter_h
19#define itkTikhonovDeconvolutionImageFilter_h
20
22
23namespace itk
24{
50template <typename TInputImage,
51 typename TKernelImage = TInputImage,
52 typename TOutputImage = TInputImage,
53 typename TInternalPrecision = double>
54class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionImageFilter
55 : public InverseDeconvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrecision>
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(TikhonovDeconvolutionImageFilter);
59
64
66 itkNewMacro(Self);
67
69 itkOverrideGetNameOfClassMacro(TikhonovDeconvolutionImageFilter);
70
72 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
73
74 using InputImageType = TInputImage;
75 using OutputImageType = TOutputImage;
76 using KernelImageType = TKernelImage;
77 using typename Superclass::InputPixelType;
78 using typename Superclass::OutputPixelType;
79 using typename Superclass::KernelPixelType;
80 using typename Superclass::InputIndexType;
81 using typename Superclass::OutputIndexType;
82 using typename Superclass::KernelIndexType;
83 using typename Superclass::InputSizeType;
84 using typename Superclass::OutputSizeType;
85 using typename Superclass::KernelSizeType;
86 using typename Superclass::SizeValueType;
87 using typename Superclass::InputRegionType;
88 using typename Superclass::OutputRegionType;
89 using typename Superclass::KernelRegionType;
90
92 using typename Superclass::InternalImageType;
97
103 itkSetMacro(RegularizationConstant, double);
104 itkGetConstMacro(RegularizationConstant, double);
106protected:
109
111 void
112 GenerateData() override;
113
114 void
115 PrintSelf(std::ostream & os, Indent indent) const override;
116
117private:
119};
120
121namespace Functor
122{
123template <typename TInput1, typename TInput2, typename TOutput>
124class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionFunctor
125{
126public:
130
131 bool
133 {
134 return true;
135 }
136
138
139 inline TOutput
140 operator()(const TInput1 & I, const TInput2 & H) const
141 {
142 const typename TOutput::value_type normH = std::norm(H);
143 const typename TOutput::value_type denominator = normH + m_RegularizationConstant;
144 TOutput value{};
145 if (denominator >= m_KernelZeroMagnitudeThreshold)
146 {
147 value = static_cast<TOutput>(I * (std::conj(H) / denominator));
148 }
149
150 return value;
151 }
152
156 void
158 {
159 m_RegularizationConstant = constant;
160 }
161 [[nodiscard]] double
166
170 void
175 [[nodiscard]] double
180
181private:
184};
185} // namespace Functor
186
187} // namespace itk
188
189#ifndef ITK_MANUAL_INSTANTIATION
190# include "itkTikhonovDeconvolutionImageFilter.hxx"
191#endif
192
193#endif
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(TikhonovDeconvolutionFunctor)
bool operator==(const TikhonovDeconvolutionFunctor &) const
TOutput operator()(const TInput1 &I, const TInput2 &H) const
TikhonovDeconvolutionFunctor(const TikhonovDeconvolutionFunctor &f)=default
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > Superclass
~TikhonovDeconvolutionImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....