ITK  6.0.0
Insight Toolkit
itkDiscreteGaussianDerivativeImageFunction.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 itkDiscreteGaussianDerivativeImageFunction_h
19 #define itkDiscreteGaussianDerivativeImageFunction_h
20 
23 
24 namespace itk
25 {
46 template <typename TInputImage, typename TOutput = double>
47 class ITK_TEMPLATE_EXPORT DiscreteGaussianDerivativeImageFunction : public ImageFunction<TInputImage, TOutput, TOutput>
48 {
49 public:
50 
53 
56 
60 
62  itkNewMacro(Self);
63 
65  itkOverrideGetNameOfClassMacro(DiscreteGaussianDerivativeImageFunction);
66 
68  using typename Superclass::InputImageType;
69  using typename Superclass::InputPixelType;
70  using typename Superclass::IndexType;
71  using typename Superclass::IndexValueType;
72  using typename Superclass::ContinuousIndexType;
73  using typename Superclass::PointType;
74 
76  static constexpr unsigned int ImageDimension2 = InputImageType::ImageDimension;
77 
79  using typename Superclass::OutputType;
80 
84 
86 
89 
92 
97 
99 #if !defined(ITK_LEGACY_REMOVE)
100 
101  static constexpr InterpolationModeEnum NearestNeighbourInterpolation =
102  InterpolationModeEnum::NearestNeighbourInterpolation;
103  static constexpr InterpolationModeEnum LinearInterpolation = InterpolationModeEnum::LinearInterpolation;
104 #endif
105 
106 public:
108  OutputType
109  Evaluate(const PointType & point) const override;
110 
112  OutputType
113  EvaluateAtIndex(const IndexType & index) const override;
114 
116  OutputType
117  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override;
118 
125  itkSetMacro(Variance, VarianceArrayType);
126  itkGetConstMacro(Variance, const VarianceArrayType);
127  itkSetVectorMacro(Variance, double, VarianceArrayType::Length);
131  virtual void
132  SetVariance(double variance)
133  {
134  m_Variance.Fill(variance);
135  this->Modified();
136  }
142  void
143  SetSigma(const double sigma)
144  {
145  SetVariance(sigma * sigma);
146  }
147 
154  itkSetClampMacro(MaximumError, double, 0.00001, 0.99999);
155  itkGetConstMacro(MaximumError, double);
159  itkSetMacro(Order, OrderArrayType);
160  itkGetConstMacro(Order, const OrderArrayType);
161  itkSetVectorMacro(Order, unsigned int, OrderArrayType::Length);
165  virtual void
166  SetOrder(unsigned int order)
167  {
168  m_Order.Fill(order);
169  this->Modified();
170  }
176  itkSetMacro(NormalizeAcrossScale, bool);
177  itkGetConstMacro(NormalizeAcrossScale, bool);
178  itkBooleanMacro(NormalizeAcrossScale);
182  itkSetMacro(UseImageSpacing, bool);
183  itkGetConstMacro(UseImageSpacing, bool);
184  itkBooleanMacro(UseImageSpacing);
191  itkSetMacro(MaximumKernelWidth, unsigned int);
192  itkGetConstMacro(MaximumKernelWidth, unsigned int);
196  itkSetEnumMacro(InterpolationMode, InterpolationModeEnum);
197  itkGetEnumMacro(InterpolationMode, InterpolationModeEnum);
204  void
205  SetInputImage(const InputImageType * ptr) override;
206 
210  virtual void
212  {
213  RecomputeGaussianKernel();
214  }
215 
216 protected:
219 
220  ~DiscreteGaussianDerivativeImageFunction() override = default;
221 
222  void
223  operator=(const Self &)
224  {}
225  void
226  PrintSelf(std::ostream & os, Indent indent) const override;
227 
228  void
229  RecomputeGaussianKernel();
230 
231 private:
233  VarianceArrayType m_Variance{};
234 
236  OrderArrayType m_Order{};
237 
240  double m_MaximumError{ 0.005 };
241 
245  unsigned int m_MaximumKernelWidth{ 30 };
246 
249 
252  KernelType m_DerivativeKernel{};
253 
255  OperatorImageFunctionPointer m_OperatorImageFunction{};
256 
258  bool m_NormalizeAcrossScale{ true };
259 
261  bool m_UseImageSpacing{ true };
262 
264  InterpolationModeEnum m_InterpolationMode{ InterpolationModeEnum::NearestNeighbourInterpolation };
265 };
266 } // namespace itk
267 
268 #ifndef ITK_MANUAL_INSTANTIATION
269 # include "itkDiscreteGaussianDerivativeImageFunction.hxx"
270 #endif
271 
272 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ImageFunction< TInputImage, TOutput, TOutput >::IndexType
typename InputImageType::IndexType IndexType
Definition: itkImageFunction.h:90
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Neighborhood< TOutput, Self::ImageDimension2 >
itk::DiscreteGaussianDerivativeImageFunction::operator=
void operator=(const Self &)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:223
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FunctionBase< Point< TOutput, TInputImage::ImageDimension >, TOutput >::OutputType
TOutput OutputType
Definition: itkFunctionBase.h:62
itk::IndexValueType
long IndexValueType
Definition: itkIntTypes.h:93
itk::DiscreteGaussianDerivativeImageFunction::OperatorImageFunctionPointer
typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer
Definition: itkDiscreteGaussianDerivativeImageFunction.h:96
itk::DiscreteGaussianDerivativeImageFunction::SetSigma
void SetSigma(const double sigma)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:143
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::DiscreteGaussianDerivativeImageFunction::SetVariance
virtual void SetVariance(double variance)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:132
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
itkGaussianDerivativeOperator.h
itk::NeighborhoodOperatorImageFunction
Compute the convolution of a neighborhood operator with the image at a specific location in space,...
Definition: itkNeighborhoodOperatorImageFunction.h:41
itk::DiscreteGaussianDerivativeImageFunction::SetOrder
virtual void SetOrder(unsigned int order)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:166
itk::FixedArray< double, Self::ImageDimension2 >
itk::GaussianDerivativeOperatorEnums::InterpolationMode
InterpolationMode
Definition: itkGaussianDerivativeOperator.h:42
itk::DiscreteGaussianDerivativeImageFunction
Compute the discrete gaussian derivatives of an the image at a specific location in space,...
Definition: itkDiscreteGaussianDerivativeImageFunction.h:47
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ContinuousIndex< TOutput, Self::ImageDimension >
itkNeighborhoodOperatorImageFunction.h
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::DiscreteGaussianDerivativeImageFunction::Initialize
virtual void Initialize()
Definition: itkDiscreteGaussianDerivativeImageFunction.h:211
itk::GaussianDerivativeOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
Definition: itkGaussianDerivativeOperator.h:105
itk::DiscreteGaussianDerivativeImageFunction::DiscreteGaussianDerivativeImageFunction
DiscreteGaussianDerivativeImageFunction(const Self &)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:218