ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkGaussianDerivativeImageFunction.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 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,
52  Vector< TOutput, TInputImage::ImageDimension >,
53  TOutput >
54 {
55 public:
56  ITK_DISALLOW_COPY_AND_ASSIGN(GaussianDerivativeImageFunction);
57 
60  using Superclass = ImageFunction< TInputImage,
62  TOutput >;
65 
67  itkNewMacro(Self);
68 
71 
73  using InputImageType = TInputImage;
74  using InputPixelType = typename InputImageType::PixelType;
76 
78  static constexpr unsigned int ImageDimension = InputImageType::ImageDimension;
79 
80 #if !defined( ITK_LEGACY_REMOVE )
81  static constexpr unsigned int ImageDimension2 = ImageDimension;
82 #endif
83 
84  using ContinuousIndexType =
86 
89 
91  using OutputType = typename Superclass::OutputType;
93 
96 
97 #if !defined( ITK_LEGACY_REMOVE )
98  using GaussianDerivativeFunctionType = GaussianDerivativeSpatialFunctionType;
99  using GaussianDerivativeFunctionPointer = GaussianDerivativeSpatialFunctionPointer;
100 #endif
101 
103  // using PointType = Point< TOutput, Self::ImageDimension >;
105 
107  OutputType Evaluate(const PointType & point) const override;
108 
110  OutputType EvaluateAtIndex(const IndexType & index) const override;
111 
113  OutputType EvaluateAtContinuousIndex(
114  const ContinuousIndexType & index) const override;
115 
120  void SetUseImageSpacing(const bool val)
121  {
122  if(val != this->m_UseImageSpacing)
123  {
124  this->m_UseImageSpacing = val;
125  this->RecomputeGaussianKernel();
126  }
127  }
128  itkBooleanMacro(UseImageSpacing);
129  itkGetMacro(UseImageSpacing,bool);
131 
137  void SetSigma(const double *sigma);
138 
139  void SetSigma(const double sigma);
140 
141  const double * GetSigma() const { return m_Sigma; }
142 
144  void SetExtent(const double *extent);
145 
146  void SetExtent(const double extent);
147 
148  const double * GetExtent() const { return m_Extent; }
149 
154  void SetInputImage(const InputImageType *ptr) override;
155 
156 protected:
158  ~GaussianDerivativeImageFunction() override = default;
159 
160  void PrintSelf(std::ostream & os, Indent indent) const override;
161 
164  void RecomputeGaussianKernel();
165 
166 private:
167 
168  double m_Sigma[ImageDimension];
169 
174 
175  std::vector<Offset<ImageDimension>> m_ImageNeighborhoodOffsets[ImageDimension];
176 
177  double m_Extent[ImageDimension];
178 
180  bool m_UseImageSpacing{ true };
181 
184 };
185 } // namespace itk
186 
187 #ifndef ITK_MANUAL_INSTANTIATION
188 #include "itkGaussianDerivativeImageFunction.hxx"
189 #endif
190 
191 #endif
typename GaussianDerivativeSpatialFunctionType::Pointer GaussianDerivativeSpatialFunctionPointer
Light weight base class for most itk classes.
A light-weight container object for storing an N-dimensional neighborhood of values.
N-dimensional Gaussian spatial function class.
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
const GaussianDerivativeSpatialFunctionPointer m_GaussianDerivativeSpatialFunction
A templated class holding a point in n-Dimensional image space.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Compute the Gaussian derivatives of an the image at a specific location in space, i...
Evaluates a function of an image at specified position.
typename InputImageType::PixelType InputPixelType