ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWienerDeconvolutionImageFilter.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 itkWienerDeconvolutionImageFilter_h
19#define itkWienerDeconvolutionImageFilter_h
20
22#include "itkMath.h"
23
24namespace itk
25{
76template <typename TInputImage,
77 typename TKernelImage = TInputImage,
78 typename TOutputImage = TInputImage,
79 typename TInternalPrecision = double>
80class ITK_TEMPLATE_EXPORT WienerDeconvolutionImageFilter
81 : public InverseDeconvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrecision>
82{
83public:
84 ITK_DISALLOW_COPY_AND_MOVE(WienerDeconvolutionImageFilter);
86
91
93 itkNewMacro(Self);
94
96 itkOverrideGetNameOfClassMacro(WienerDeconvolutionImageFilter);
97
99 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
100
101 using InputImageType = TInputImage;
102 using OutputImageType = TOutputImage;
103 using KernelImageType = TKernelImage;
104 using typename Superclass::InputPixelType;
105 using typename Superclass::OutputPixelType;
106 using typename Superclass::KernelPixelType;
107 using typename Superclass::InputIndexType;
108 using typename Superclass::OutputIndexType;
109 using typename Superclass::KernelIndexType;
110 using typename Superclass::InputSizeType;
111 using typename Superclass::OutputSizeType;
112 using typename Superclass::KernelSizeType;
113 using typename Superclass::SizeValueType;
114 using typename Superclass::InputRegionType;
115 using typename Superclass::OutputRegionType;
116 using typename Superclass::KernelRegionType;
117
119 using typename Superclass::InternalImageType;
121 using typename Superclass::InternalComplexType;
124
127 itkSetMacro(NoiseVariance, double);
128 itkGetConstMacro(NoiseVariance, double);
130
131protected:
134
136 void
137 GenerateData() override;
138
139 void
140 PrintSelf(std::ostream & os, Indent indent) const override;
141
142private:
144};
145
146namespace Functor
147{
148template <typename TPixel>
149class ITK_TEMPLATE_EXPORT WienerDeconvolutionFunctor
150{
151public:
158
159 bool
161 {
162 return true;
163 }
164
166
167 inline TPixel
168 operator()(const TPixel & I, const TPixel & H) const
169 {
171
172 // We estimate the power spectral density of the output image to
173 // be the same as the power spectral density of the blurred input
174 // minus the power spectral density of the noise.
175 TPixel Pf = std::norm(I);
176
177 TPixel denominator = std::norm(H) + (Pn / (Pf - Pn));
178 TPixel value{};
180 {
181 value = I * (std::conj(H) / denominator);
182 }
183
184 return value;
185 }
186
189 void
194 double
199
200
203 void
208 double
213
214
215private:
218};
219} // namespace Functor
220
221} // namespace itk
222
223#ifndef ITK_MANUAL_INSTANTIATION
224# include "itkWienerDeconvolutionImageFilter.hxx"
225#endif
226
227#endif
bool operator==(const WienerDeconvolutionFunctor &) const
WienerDeconvolutionFunctor(const WienerDeconvolutionFunctor &f)
TPixel operator()(const TPixel &I, const TPixel &H) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(WienerDeconvolutionFunctor)
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
~WienerDeconvolutionImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > Superclass
bool abs(bool x)
Definition itkMath.h:837
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....