ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkInverseDeconvolutionImageFilter.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 itkInverseDeconvolutionImageFilter_h
19 #define itkInverseDeconvolutionImageFilter_h
20 
22 
23 namespace itk
24 {
53 template< typename TInputImage, typename TKernelImage = TInputImage, typename TOutputImage = TInputImage, typename TInternalPrecision=double >
54 class ITK_TEMPLATE_EXPORT InverseDeconvolutionImageFilter :
55  public FFTConvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision >
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_ASSIGN(InverseDeconvolutionImageFilter);
59 
61  using Superclass = FFTConvolutionImageFilter< TInputImage,
62  TKernelImage,
63  TOutputImage,
64  TInternalPrecision >;
67 
69  itkNewMacro(Self);
70 
73 
75  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
76 
77  using InputImageType = TInputImage;
78  using OutputImageType = TOutputImage;
79  using KernelImageType = TKernelImage;
80  using InputPixelType = typename Superclass::InputPixelType;
81  using OutputPixelType = typename Superclass::OutputPixelType;
82  using KernelPixelType = typename Superclass::KernelPixelType;
83  using InputIndexType = typename Superclass::InputIndexType;
84  using OutputIndexType = typename Superclass::OutputIndexType;
85  using KernelIndexType = typename Superclass::KernelIndexType;
86  using InputSizeType = typename Superclass::InputSizeType;
87  using OutputSizeType = typename Superclass::OutputSizeType;
88  using KernelSizeType = typename Superclass::KernelSizeType;
90  using InputRegionType = typename Superclass::InputRegionType;
91  using OutputRegionType = typename Superclass::OutputRegionType;
92  using KernelRegionType = typename Superclass::KernelRegionType;
93 
95  using InternalImageType = typename Superclass::InternalImageType;
96  using InternalImagePointerType = typename Superclass::InternalImagePointerType;
97  using InternalComplexType = typename Superclass::InternalComplexType;
98  using InternalComplexImageType = typename Superclass::InternalComplexImageType;
99  using InternalComplexImagePointerType = typename Superclass::InternalComplexImagePointerType;
100 
104  itkSetMacro(KernelZeroMagnitudeThreshold, double);
105  itkGetConstMacro(KernelZeroMagnitudeThreshold, double);
107 
108 protected:
110  ~InverseDeconvolutionImageFilter() override = default;
111 
113  void GenerateData() override;
114 
115  void PrintSelf(std::ostream & os, Indent indent) const override;
116 
117 private:
119 };
120 
121 namespace Functor
122 {
123 template< typename TInput1, typename TInput2, typename TOutput >
124 class ITK_TEMPLATE_EXPORT InverseDeconvolutionFunctor
125 {
126 public:
127  InverseDeconvolutionFunctor() { m_KernelZeroMagnitudeThreshold = 0.0; }
128  ~InverseDeconvolutionFunctor() = default;
129 
131  {
132  return false;
133  }
134  bool operator==( const InverseDeconvolutionFunctor & other) const
135  {
136  return !(*this != other);
137  }
138  inline TOutput operator()(const TInput1 & I, const TInput2 & H) const
139  {
140  const double absH = std::abs( H );
141  TOutput value = NumericTraits< TOutput >::ZeroValue();
142  if ( absH >= m_KernelZeroMagnitudeThreshold )
143  {
144  value = static_cast< TOutput >( I / H );
145  }
146  return value;
147  }
148 
152  {
153  m_KernelZeroMagnitudeThreshold = mu;
154  }
156  {
157  return m_KernelZeroMagnitudeThreshold;
158  }
160 
161 private:
163 };
164 } //namespace Functor
165 
166 }
167 
168 #ifndef ITK_MANUAL_INSTANTIATION
169 #include "itkInverseDeconvolutionImageFilter.hxx"
170 #endif
171 
172 #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
typename OutputImageType::PixelType OutputPixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
TOutput operator()(const TInput1 &I, const TInput2 &H) const
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
Convolve a given image with an arbitrary image kernel using multiplication in the Fourier domain...
bool operator!=(const InverseDeconvolutionFunctor &) const
typename InternalComplexImageType::Pointer InternalComplexImagePointerType
std::complex< TInternalPrecision > InternalComplexType
TOutputImage OutputImageType
typename InputImageType::SizeType InputSizeType
typename InputImageType::IndexType InputIndexType
bool operator==(const InverseDeconvolutionFunctor &other) const
typename KernelImageType::RegionType KernelRegionType
typename OutputImageType::RegionType OutputRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename OutputImageType::SizeType OutputSizeType
typename KernelImageType::IndexType KernelIndexType
The direct linear inverse deconvolution filter.
Templated n-dimensional image class.
Definition: itkImage.h:75