ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkTikhonovDeconvolutionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkTikhonovDeconvolutionImageFilter_h
19 #define itkTikhonovDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
49 template< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
50 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionImageFilter :
51  public InverseDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision >
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(TikhonovDeconvolutionImageFilter);
55 
57  using Superclass = InverseDeconvolutionImageFilter< TInputImage,
58  TKernelImage,
59  TOutputImage,
60  TInternalPrecision >;
63 
65  itkNewMacro(Self);
66 
69 
71  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
72 
73  using InputImageType = TInputImage;
74  using OutputImageType = TOutputImage;
75  using KernelImageType = TKernelImage;
76  using InputPixelType = typename Superclass::InputPixelType;
77  using OutputPixelType = typename Superclass::OutputPixelType;
78  using KernelPixelType = typename Superclass::KernelPixelType;
79  using InputIndexType = typename Superclass::InputIndexType;
80  using OutputIndexType = typename Superclass::OutputIndexType;
81  using KernelIndexType = typename Superclass::KernelIndexType;
82  using InputSizeType = typename Superclass::InputSizeType;
83  using OutputSizeType = typename Superclass::OutputSizeType;
84  using KernelSizeType = typename Superclass::KernelSizeType;
86  using InputRegionType = typename Superclass::InputRegionType;
87  using OutputRegionType = typename Superclass::OutputRegionType;
88  using KernelRegionType = typename Superclass::KernelRegionType;
89 
91  using InternalImageType = typename Superclass::InternalImageType;
92  using InternalImagePointerType = typename Superclass::InternalImagePointerType;
93  using InternalComplexType = typename Superclass::InternalComplexType;
94  using InternalComplexImageType = typename Superclass::InternalComplexImageType;
95  using InternalComplexImagePointerType = typename Superclass::InternalComplexImagePointerType;
96 
101  itkSetMacro(RegularizationConstant, double);
102  itkGetConstMacro(RegularizationConstant, double);
104 
105 protected:
107  ~TikhonovDeconvolutionImageFilter() override = default;
108 
110  void GenerateData() override;
111 
112  void PrintSelf(std::ostream & os, Indent indent) const override;
113 
114 private:
116 };
117 
118 namespace Functor
119 {
120 template< typename TInput1, typename TInput2, typename TOutput >
121 class ITK_TEMPLATE_EXPORT TikhonovDeconvolutionFunctor
122 {
123 public:
124  TikhonovDeconvolutionFunctor() {m_RegularizationConstant = 0.0;}
125  ~TikhonovDeconvolutionFunctor() = default;
126 
128  {
129  return false;
130  }
131  bool operator==( const TikhonovDeconvolutionFunctor & other) const
132  {
133  return !(*this != other);
134  }
135  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
136  {
137  typename TOutput::value_type normH = std::norm( H );
138  typename TOutput::value_type denominator = normH + m_RegularizationConstant;
139  TOutput value = NumericTraits< TOutput >::ZeroValue();
140  if ( denominator >= m_KernelZeroMagnitudeThreshold )
141  {
142  value = static_cast< TOutput >( I * ( std::conj( H ) / denominator ) );
143  }
144 
145  return value;
146  }
147 
150  void SetRegularizationConstant(double constant)
151  {
152  m_RegularizationConstant = constant;
153  }
155  {
156  return m_RegularizationConstant;
157  }
159 
163  {
164  m_KernelZeroMagnitudeThreshold = mu;
165  }
167  {
168  return m_KernelZeroMagnitudeThreshold;
169  }
171 
172 private:
175 };
176 } //namespace Functor
177 
178 }
179 
180 #ifndef ITK_MANUAL_INSTANTIATION
181 #include "itkTikhonovDeconvolutionImageFilter.hxx"
182 #endif
183 
184 #endif
typename InternalImageType::Pointer InternalImagePointerType
typename InputImageType::PixelType InputPixelType
typename KernelImageType::SizeType KernelSizeType
typename OutputImageType::IndexType OutputIndexType
Define numeric traits for std::vector.
typename InputSizeType::SizeValueType SizeValueType
An inverse deconvolution filter regularized in the Tikhonov sense.
typename OutputImageType::PixelType OutputPixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename KernelImageType::PixelType KernelPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename InputImageType::RegionType InputRegionType
typename InternalComplexImageType::Pointer InternalComplexImagePointerType
std::complex< TInternalPrecision > InternalComplexType
TOutputImage OutputImageType
bool operator!=(const TikhonovDeconvolutionFunctor &) const
typename InputImageType::SizeType InputSizeType
typename InputImageType::IndexType InputIndexType
bool operator==(const TikhonovDeconvolutionFunctor &other) const
typename KernelImageType::RegionType KernelRegionType
typename OutputImageType::RegionType OutputRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename OutputImageType::SizeType OutputSizeType
TOutput operator()(const TInput1 &I, const TInput2 &H) const
typename KernelImageType::IndexType KernelIndexType
The direct linear inverse deconvolution filter.
Templated n-dimensional image class.
Definition: itkImage.h:75