ITK  6.0.0
Insight Toolkit
itkGaussianBlurImageFunction.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 itkGaussianBlurImageFunction_h
19 #define itkGaussianBlurImageFunction_h
20 
22 #include "itkGaussianOperator.h"
24 
25 namespace itk
26 {
38 template <typename TInputImage, typename TOutput = double>
39 class ITK_TEMPLATE_EXPORT GaussianBlurImageFunction : public ImageFunction<TInputImage, TOutput>
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(GaussianBlurImageFunction);
43 
46 
49 
53 
55  itkNewMacro(Self);
56 
58  itkOverrideGetNameOfClassMacro(GaussianBlurImageFunction);
59 
61  using InputImageType = TInputImage;
62  using InputPixelType = typename InputImageType::PixelType;
63  using typename Superclass::IndexType;
64  using typename Superclass::ContinuousIndexType;
65 
67  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
68 
72 
78 
81 
84 
88 
90  using typename Superclass::PointType;
91 
93  TOutput
94  Evaluate(const PointType & point) const override;
95 
97  TOutput
98  EvaluateAtIndex(const IndexType & index) const override;
99 
101  TOutput
102  EvaluateAtContinuousIndex(const ContinuousIndexType & cindex) const override;
103 
110  void
111  SetSigma(const double * sigma);
112 
113  void
114  SetSigma(const float * sigma);
115 
116  void
117  SetSigma(const double sigma);
118 
119  itkSetMacro(Sigma, SigmaArrayType);
120  itkGetConstReferenceMacro(Sigma, SigmaArrayType);
121 
126  void
127  SetInputImage(const InputImageType * ptr) override;
128 
132  itkSetMacro(Extent, ExtentArrayType);
133  itkGetConstReferenceMacro(Extent, ExtentArrayType);
134  void
135  SetExtent(const double * extent);
138  void
139  SetExtent(const double extent);
140 
144  itkSetMacro(MaximumError, ErrorArrayType);
145  itkGetConstReferenceMacro(MaximumError, ErrorArrayType);
152  itkSetMacro(MaximumKernelWidth, int);
153  itkGetConstMacro(MaximumKernelWidth, int);
161  itkSetMacro(UseImageSpacing, bool);
162  itkGetConstMacro(UseImageSpacing, bool);
163  itkBooleanMacro(UseImageSpacing);
166 protected:
168  ~GaussianBlurImageFunction() override = default;
169 
170  void
171  PrintSelf(std::ostream & os, Indent indent) const override;
172 
173  void
174  RecomputeGaussianKernel();
175 
176  void
177  RecomputeContinuousGaussianKernel(const double * offset) const;
178 
179 private:
180  virtual TOutput
181  EvaluateAtIndex(const IndexType & index, const OperatorArrayType & operatorArray) const;
182 
183  SigmaArrayType m_Sigma{};
184  OperatorImageFunctionPointer m_OperatorImageFunction{};
185  OperatorInternalImageFunctionPointer m_OperatorInternalImageFunction{};
186  mutable OperatorArrayType m_OperatorArray{};
187  mutable OperatorArrayType m_ContinuousOperatorArray{};
188  InternalImagePointer m_InternalImage{};
189 
193  ErrorArrayType m_MaximumError{};
194  ExtentArrayType m_Extent{};
195 
198  int m_MaximumKernelWidth{};
199 
201  unsigned int m_FilterDimensionality{};
202 
204  bool m_UseImageSpacing{ true };
205 
207  GaussianFunctionPointer m_GaussianFunction{};
208 };
209 } // end namespace itk
210 
211 #ifndef ITK_MANUAL_INSTANTIATION
212 # include "itkGaussianBlurImageFunction.hxx"
213 #endif
214 
215 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::GaussianBlurImageFunction::InternalImagePointer
typename InternalImageType::Pointer InternalImagePointer
Definition: itkGaussianBlurImageFunction.h:77
itk::ImageFunction< TInputImage, TOutput >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkImageFunction.h:90
itk::GaussianBlurImageFunction::GaussianFunctionPointer
typename GaussianFunctionType::Pointer GaussianFunctionPointer
Definition: itkGaussianBlurImageFunction.h:74
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Neighborhood< TOutput, Self::ImageDimension >
itk::GaussianBlurImageFunction::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkGaussianBlurImageFunction.h:62
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GaussianBlurImageFunction::InputImageType
TInputImage InputImageType
Definition: itkGaussianBlurImageFunction.h:61
itk::GaussianSpatialFunction
N-dimensional Gaussian spatial function class.
Definition: itkGaussianSpatialFunction.h:44
itk::GaussianBlurImageFunction::InputPixelRealType
typename NumericTraits< InputPixelType >::RealType InputPixelRealType
Definition: itkGaussianBlurImageFunction.h:75
itkGaussianSpatialFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::GaussianBlurImageFunction
Compute the convolution of a neighborhood operator with the image at a specific location in space,...
Definition: itkGaussianBlurImageFunction.h:39
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::point
*par Constraints *The filter requires an image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
itk::NeighborhoodOperatorImageFunction
Compute the convolution of a neighborhood operator with the image at a specific location in space,...
Definition: itkNeighborhoodOperatorImageFunction.h:41
itk::GaussianOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.
Definition: itkGaussianOperator.h:69
itk::FixedArray< NeighborhoodType, Self::ImageDimension >
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::GaussianBlurImageFunction::OperatorImageFunctionPointer
typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer
Definition: itkGaussianBlurImageFunction.h:80
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< float, Self::ImageDimension >
itkNeighborhoodOperatorImageFunction.h
itk::GaussianBlurImageFunction::OperatorInternalImageFunctionPointer
typename OperatorInternalImageFunctionType::Pointer OperatorInternalImageFunctionPointer
Definition: itkGaussianBlurImageFunction.h:83
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itkGaussianOperator.h