ITK  5.3.0
Insight Toolkit
itkGaussianDerivativeImageFunction.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 itkGaussianDerivativeImageFunction_h
19 #define itkGaussianDerivativeImageFunction_h
20 
21 #include "itkContinuousIndex.h"
22 #include "itkFixedArray.h"
25 #include "itkImage.h"
26 #include "itkImageFunction.h"
27 #include "itkNeighborhood.h"
28 #include "itkOffset.h"
29 #include "itkVector.h"
30 
31 #include <vector>
32 
33 namespace itk
34 {
49 template <typename TInputImage, typename TOutput = double>
50 class ITK_TEMPLATE_EXPORT GaussianDerivativeImageFunction
51  : public ImageFunction<TInputImage, Vector<TOutput, TInputImage::ImageDimension>, TOutput>
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_MOVE(GaussianDerivativeImageFunction);
55 
61 
63  itkNewMacro(Self);
64 
67 
69  using InputImageType = TInputImage;
70  using InputPixelType = typename InputImageType::PixelType;
72 
74  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
75 
76 #if !defined(ITK_LEGACY_REMOVE)
77  static constexpr unsigned int ImageDimension2 = ImageDimension;
78 #endif
79 
81 
84 
86  using typename Superclass::OutputType;
88 
91 
92 #if !defined(ITK_LEGACY_REMOVE)
93  using GaussianDerivativeFunctionType = GaussianDerivativeSpatialFunctionType;
94  using GaussianDerivativeFunctionPointer = GaussianDerivativeSpatialFunctionPointer;
95 #endif
96 
98  // using PointType = Point< TOutput, Self::ImageDimension >;
100 
102  OutputType
103  Evaluate(const PointType & point) const override;
104 
106  OutputType
107  EvaluateAtIndex(const IndexType & index) const override;
108 
110  OutputType
111  EvaluateAtContinuousIndex(const ContinuousIndexType & cindex) const override;
112 
117  void
118  SetUseImageSpacing(const bool val)
119  {
120  if (val != this->m_UseImageSpacing)
121  {
122  this->m_UseImageSpacing = val;
123  this->RecomputeGaussianKernel();
124  }
125  }
126  itkBooleanMacro(UseImageSpacing);
127  itkGetMacro(UseImageSpacing, bool);
129 
135  void
136  SetSigma(const double * sigma);
137 
138  void
139  SetSigma(const double sigma);
140 
141  const double *
142  GetSigma() const
143  {
144  return m_Sigma;
145  }
146 
148  void
149  SetExtent(const double * extent);
150 
151  void
152  SetExtent(const double extent);
153 
154  const double *
155  GetExtent() const
156  {
157  return m_Extent;
158  }
159 
164  void
165  SetInputImage(const InputImageType * ptr) override;
166 
167 protected:
169  ~GaussianDerivativeImageFunction() override = default;
170 
171  void
172  PrintSelf(std::ostream & os, Indent indent) const override;
173 
176  void
177  RecomputeGaussianKernel();
178 
179 private:
180  double m_Sigma[ImageDimension];
181 
186 
187  std::vector<Offset<ImageDimension>> m_ImageNeighborhoodOffsets[ImageDimension];
188 
189  double m_Extent[ImageDimension];
190 
192  bool m_UseImageSpacing{ true };
193 
195  const GaussianDerivativeSpatialFunctionPointer m_GaussianDerivativeSpatialFunction{
196  GaussianDerivativeSpatialFunctionType::New()
197  };
198 };
199 } // namespace itk
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 # include "itkGaussianDerivativeImageFunction.hxx"
203 #endif
204 
205 #endif
itk::GaussianDerivativeSpatialFunction
N-dimensional Gaussian spatial function class.
Definition: itkGaussianDerivativeSpatialFunction.h:42
itkImageFunction.h
itk::GaussianDerivativeImageFunction::IndexType
typename InputImageType::IndexType IndexType
Definition: itkGaussianDerivativeImageFunction.h:71
itk::GaussianDerivativeImageFunction
Compute the Gaussian derivatives of an the image at a specific location in space, i....
Definition: itkGaussianDerivativeImageFunction.h:50
itkContinuousIndex.h
itkOffset.h
itk::GaussianDerivativeImageFunction::SetUseImageSpacing
void SetUseImageSpacing(const bool val)
Definition: itkGaussianDerivativeImageFunction.h:118
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkGaussianDerivativeSpatialFunction.h
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::Neighborhood
A light-weight container object for storing an N-dimensional neighborhood of values.
Definition: itkNeighborhood.h:54
itkImage.h
itk::GaussianDerivativeImageFunction::GetExtent
const double * GetExtent() const
Definition: itkGaussianDerivativeImageFunction.h:155
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkNeighborhood.h
itk::GaussianDerivativeImageFunction::InputPixelType
typename InputImageType::PixelType InputPixelType
Definition: itkGaussianDerivativeImageFunction.h:70
itkGaussianSpatialFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::GaussianDerivativeImageFunction::InputImageType
TInputImage InputImageType
Definition: itkGaussianDerivativeImageFunction.h:69
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:59
itk::GaussianDerivativeImageFunction::m_OperatorArray
OperatorArrayType m_OperatorArray
Definition: itkGaussianDerivativeImageFunction.h:185
itkFixedArray.h
itk::FixedArray< OperatorNeighborhoodType, Self::ImageDimension >
itk::GaussianDerivativeImageFunction::GetSigma
const double * GetSigma() const
Definition: itkGaussianDerivativeImageFunction.h:142
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::GaussianDerivativeImageFunction::PointType
typename InputImageType::PointType PointType
Definition: itkGaussianDerivativeImageFunction.h:99
itk::ContinuousIndex
A templated class holding a point in n-Dimensional image space.
Definition: itkContinuousIndex.h:46
itkVector.h
itk::GaussianDerivativeImageFunction::GaussianDerivativeSpatialFunctionPointer
typename GaussianDerivativeSpatialFunctionType::Pointer GaussianDerivativeSpatialFunctionPointer
Definition: itkGaussianDerivativeImageFunction.h:90