ITK  6.0.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 * 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 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
33namespace itk
34{
49template <typename TInputImage, typename TOutput = double>
50class ITK_TEMPLATE_EXPORT GaussianDerivativeImageFunction
51 : public ImageFunction<TInputImage, Vector<TOutput, TInputImage::ImageDimension>, TOutput>
52{
53public:
54 ITK_DISALLOW_COPY_AND_MOVE(GaussianDerivativeImageFunction);
55
61
63 itkNewMacro(Self);
64
66 itkOverrideGetNameOfClassMacro(GaussianDerivativeImageFunction);
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
80 using ContinuousIndexType = typename Superclass::ContinuousIndexType;
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
103 Evaluate(const PointType & point) const override;
104
107 EvaluateAtIndex(const IndexType & index) const override;
108
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 this->Modified();
125 }
126 }
127 itkBooleanMacro(UseImageSpacing);
128 itkGetMacro(UseImageSpacing, bool);
136 void
137 SetSigma(const double * sigma);
138
139 void
140 SetSigma(const double sigma);
141
142 const double *
143 GetSigma() const
144 {
145 return m_Sigma;
146 }
147
149 void
150 SetExtent(const double * extent);
151
152 void
153 SetExtent(const double extent);
154
155 const double *
156 GetExtent() const
157 {
158 return m_Extent;
159 }
160
165 void
166 SetInputImage(const InputImageType * ptr) override;
167
168protected:
171
172 void
173 PrintSelf(std::ostream & os, Indent indent) const override;
174
177 void
179
180private:
181 double m_Sigma[ImageDimension]{};
182
186 OperatorArrayType m_OperatorArray{};
187
188 std::vector<Offset<ImageDimension>> m_ImageNeighborhoodOffsets[ImageDimension]{};
189
190 double m_Extent[ImageDimension]{};
191
193 bool m_UseImageSpacing{ true };
194
196 const GaussianDerivativeSpatialFunctionPointer m_GaussianDerivativeSpatialFunction{
198 };
199};
200} // namespace itk
201
202#ifndef ITK_MANUAL_INSTANTIATION
203# include "itkGaussianDerivativeImageFunction.hxx"
204#endif
205
206#endif
Compute the Gaussian derivatives of an the image at a specific location in space, i....
void PrintSelf(std::ostream &os, Indent indent) const override
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
void SetSigma(const double sigma)
void SetSigma(const double *sigma)
typename InputImageType::PixelType InputPixelType
void SetExtent(const double extent)
typename GaussianDerivativeSpatialFunctionType::Pointer GaussianDerivativeSpatialFunctionPointer
OutputType EvaluateAtIndex(const IndexType &index) const override
void SetExtent(const double *extent)
~GaussianDerivativeImageFunction() override=default
typename Superclass::ContinuousIndexType ContinuousIndexType
OutputType Evaluate(const PointType &point) const override
void SetInputImage(const InputImageType *ptr) override
N-dimensional Gaussian spatial function class.
Evaluates a function of an image at specified position.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A light-weight container object for storing an N-dimensional neighborhood of values.
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
static Pointer New()
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter 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