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 }
125 }
126 itkBooleanMacro(UseImageSpacing);
127 itkGetMacro(UseImageSpacing, bool);
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
167protected:
170
171 void
172 PrintSelf(std::ostream & os, Indent indent) const override;
173
176 void
178
179private:
180 double m_Sigma[ImageDimension]{};
181
185 OperatorArrayType m_OperatorArray{};
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{
197 };
198};
199} // namespace itk
200
201#ifndef ITK_MANUAL_INSTANTIATION
202# include "itkGaussianDerivativeImageFunction.hxx"
203#endif
204
205#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