ITK  5.2.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 InputPixelType = typename Superclass::InputPixelType;
83  using OutputPixelType = typename Superclass::OutputPixelType;
84  using KernelPixelType = typename Superclass::KernelPixelType;
85  using InputIndexType = typename Superclass::InputIndexType;
86  using OutputIndexType = typename Superclass::OutputIndexType;
87  using KernelIndexType = typename Superclass::KernelIndexType;
88  using InputSizeType = typename Superclass::InputSizeType;
89  using OutputSizeType = typename Superclass::OutputSizeType;
90  using KernelSizeType = typename Superclass::KernelSizeType;
92  using InputRegionType = typename Superclass::InputRegionType;
93  using OutputRegionType = typename Superclass::OutputRegionType;
94  using KernelRegionType = typename Superclass::KernelRegionType;
95 
97  using InternalImageType = typename Superclass::InternalImageType;
98  using InternalImagePointerType = typename Superclass::InternalImagePointerType;
99  using InternalComplexType = typename Superclass::InternalComplexType;
100  using InternalComplexImageType = typename Superclass::InternalComplexImageType;
101  using InternalComplexImagePointerType = 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 false;
138  }
139  bool
141  {
142  return !(*this != other);
143  }
144  inline TOutput
145  operator()(const TInput1 & I, const TInput2 & H) const
146  {
147  const double absH = std::abs(H);
148  TOutput value = NumericTraits<TOutput>::ZeroValue();
149  if (absH >= m_KernelZeroMagnitudeThreshold)
150  {
151  value = static_cast<TOutput>(I / H);
152  }
153  return value;
154  }
155 
158  void
160  {
161  m_KernelZeroMagnitudeThreshold = mu;
162  }
163  double
165  {
166  return m_KernelZeroMagnitudeThreshold;
167  }
169 
170 private:
172 };
173 } // namespace Functor
174 
175 } // namespace itk
176 
177 #ifndef ITK_MANUAL_INSTANTIATION
178 # include "itkInverseDeconvolutionImageFilter.hxx"
179 #endif
180 
181 #endif
itk::Functor::InverseDeconvolutionFunctor::operator==
bool operator==(const InverseDeconvolutionFunctor &other) const
Definition: itkInverseDeconvolutionImageFilter.h:140
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:145
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::ConvolutionImageFilterBase::OutputIndexType
typename OutputImageType::IndexType OutputIndexType
Definition: itkConvolutionImageFilterBase.h:81
itk::ConvolutionImageFilterBase::InputIndexType
typename InputImageType::IndexType InputIndexType
Definition: itkConvolutionImageFilterBase.h:80
itk::ConvolutionImageFilterBase::KernelPixelType
typename KernelImageType::PixelType KernelPixelType
Definition: itkConvolutionImageFilterBase.h:79
itk::Functor::InverseDeconvolutionFunctor::operator!=
bool operator!=(const InverseDeconvolutionFunctor &) const
Definition: itkInverseDeconvolutionImageFilter.h:135
itk::Functor::InverseDeconvolutionFunctor::GetKernelZeroMagnitudeThreshold
double GetKernelZeroMagnitudeThreshold() const
Definition: itkInverseDeconvolutionImageFilter.h:164
itkFFTConvolutionImageFilter.h
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::Functor::InverseDeconvolutionFunctor::m_KernelZeroMagnitudeThreshold
double m_KernelZeroMagnitudeThreshold
Definition: itkInverseDeconvolutionImageFilter.h:171
itk::InverseDeconvolutionImageFilter
The direct linear inverse deconvolution filter.
Definition: itkInverseDeconvolutionImageFilter.h:58
itk::FFTConvolutionImageFilter::InternalComplexType
std::complex< TInternalPrecision > InternalComplexType
Definition: itkFFTConvolutionImageFilter.h:99
itk::ConvolutionImageFilterBase::KernelIndexType
typename KernelImageType::IndexType KernelIndexType
Definition: itkConvolutionImageFilterBase.h:82
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::ConvolutionImageFilterBase::OutputPixelType
typename OutputImageType::PixelType OutputPixelType
Definition: itkConvolutionImageFilterBase.h:78
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::Functor::InverseDeconvolutionFunctor
Definition: itkInverseDeconvolutionImageFilter.h:128
itk::Functor::InverseDeconvolutionFunctor::SetKernelZeroMagnitudeThreshold
void SetKernelZeroMagnitudeThreshold(double mu)
Definition: itkInverseDeconvolutionImageFilter.h:159
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::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::InverseDeconvolutionImageFilter::m_KernelZeroMagnitudeThreshold
double m_KernelZeroMagnitudeThreshold
Definition: itkInverseDeconvolutionImageFilter.h:122
itk::ConvolutionImageFilterBase::KernelSizeType
typename KernelImageType::SizeType KernelSizeType
Definition: itkConvolutionImageFilterBase.h:85