ITK  5.2.0
Insight Toolkit
itkDiscreteGradientMagnitudeGaussianImageFunction.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 itkDiscreteGradientMagnitudeGaussianImageFunction_h
19 #define itkDiscreteGradientMagnitudeGaussianImageFunction_h
20 
23 
24 namespace itk
25 {
46 template <typename TInputImage, typename TOutput = double>
48  : public ImageFunction<TInputImage, TOutput, TOutput>
49 {
50 public:
51 
54 
57 
61 
63  itkNewMacro(Self);
64 
67 
69  using InputImageType = typename Superclass::InputImageType;
70  using InputPixelType = typename Superclass::InputPixelType;
71  using IndexType = typename Superclass::IndexType;
73  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
74  using PointType = typename Superclass::PointType;
75 
77  static constexpr unsigned int ImageDimension2 = InputImageType::ImageDimension;
78 
80  using OutputType = typename Superclass::OutputType;
81 
85 
87 
90 
93 
97 
101 
103 #if !defined(ITK_LEGACY_REMOVE)
104 
105  static constexpr InterpolationModeEnum NearestNeighbourInterpolation =
106  InterpolationModeEnum::NearestNeighbourInterpolation;
107  static constexpr InterpolationModeEnum LinearInterpolation = InterpolationModeEnum::LinearInterpolation;
108 #endif
109 
110 public:
112  OutputType
113  Evaluate(const PointType & point) const override;
114 
116  OutputType
117  EvaluateAtIndex(const IndexType & index) const override;
118 
120  OutputType
121  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override;
122 
127  itkSetMacro(Variance, VarianceArrayType);
128  itkGetConstMacro(Variance, const VarianceArrayType);
129  itkSetVectorMacro(Variance, double, VarianceArrayType::Length);
131 
133  virtual void
134  SetVariance(double variance)
135  {
136  m_Variance.Fill(variance);
137  this->Modified();
138  }
140 
143  void
144  SetSigma(const double sigma)
145  {
146  SetVariance(sigma * sigma);
147  }
148 
154  itkSetClampMacro(MaximumError, double, 0.00001, 0.99999);
155  itkGetConstMacro(MaximumError, double);
157 
161  itkSetMacro(NormalizeAcrossScale, bool);
162  itkGetConstMacro(NormalizeAcrossScale, bool);
163  itkBooleanMacro(NormalizeAcrossScale);
165 
167  itkSetMacro(UseImageSpacing, bool);
168  itkGetConstMacro(UseImageSpacing, bool);
169  itkBooleanMacro(UseImageSpacing);
171 
176  itkSetMacro(MaximumKernelWidth, unsigned int);
177  itkGetConstMacro(MaximumKernelWidth, unsigned int);
179 
181  itkSetEnumMacro(InterpolationMode, InterpolationModeEnum);
182  itkGetEnumMacro(InterpolationMode, InterpolationModeEnum);
184 
189  void
190  SetInputImage(const InputImageType * ptr) override;
191 
194  virtual void
196  {
197  RecomputeGaussianKernel();
198  }
199 
200 protected:
203 
205 
206  void
207  operator=(const Self &)
208  {}
209  void
210  PrintSelf(std::ostream & os, Indent indent) const override;
211 
212  void
213  RecomputeGaussianKernel();
214 
215  // void RecomputeContinuousGaussianKernel(
216  // const double* offset) const;
217 
218 private:
221 
224  double m_MaximumError{ 0.005 };
225 
229  unsigned int m_MaximumKernelWidth{ 30 };
230 
235 
238 
241 
243  bool m_NormalizeAcrossScale{ true };
244 
246  bool m_UseImageSpacing{ true };
247 
249  InterpolationModeEnum m_InterpolationMode{ InterpolationModeEnum::NearestNeighbourInterpolation };
250 };
251 } // namespace itk
252 
253 #ifndef ITK_MANUAL_INSTANTIATION
254 # include "itkDiscreteGradientMagnitudeGaussianImageFunction.hxx"
255 #endif
256 
257 #endif
itk::DiscreteGradientMagnitudeGaussianImageFunction::IndexValueType
typename Superclass::IndexValueType IndexValueType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:72
itk::DiscreteGradientMagnitudeGaussianImageFunction::m_KernelArray
KernelArrayType m_KernelArray
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:237
itk::DiscreteGradientMagnitudeGaussianImageFunction::IndexType
typename Superclass::IndexType IndexType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:71
itk::DiscreteGradientMagnitudeGaussianImageFunction
Compute the discrete gradient magnitude gaussian of an the image at a specific location in space,...
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:47
itk::DiscreteGradientMagnitudeGaussianImageFunction::PointType
typename Superclass::PointType PointType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:74
itk::DiscreteGradientMagnitudeGaussianImageFunction::InputPixelType
typename Superclass::InputPixelType InputPixelType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:70
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::DiscreteGradientMagnitudeGaussianImageFunction::Initialize
virtual void Initialize()
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:195
itk::Neighborhood< TOutput, Self::ImageDimension2 >
InterpolationMode
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GaussianDerivativeOperatorEnums::InterpolationMode
InterpolationMode
Definition: itkGaussianDerivativeOperator.h:43
itk::DiscreteGradientMagnitudeGaussianImageFunction::DiscreteGradientMagnitudeGaussianImageFunction
DiscreteGradientMagnitudeGaussianImageFunction(const Self &)
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:202
itk::DiscreteGradientMagnitudeGaussianImageFunction::m_Variance
VarianceArrayType m_Variance
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:220
itk::DiscreteGradientMagnitudeGaussianImageFunction::m_OperatorArray
GaussianDerivativeOperatorArrayType m_OperatorArray
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:234
itk::DiscreteGradientMagnitudeGaussianImageFunction::SetVariance
virtual void SetVariance(double variance)
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:134
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::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
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::DiscreteGradientMagnitudeGaussianImageFunction::OperatorImageFunctionPointer
typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:100
itk::DiscreteGradientMagnitudeGaussianImageFunction::operator=
void operator=(const Self &)
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:207
itk::DiscreteGradientMagnitudeGaussianImageFunction::InputImageType
typename Superclass::InputImageType InputImageType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:69
itk::FixedArray< double, Self::ImageDimension2 >
itk::DiscreteGradientMagnitudeGaussianImageFunction::ContinuousIndexType
typename Superclass::ContinuousIndexType ContinuousIndexType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:73
itk::DiscreteGradientMagnitudeGaussianImageFunction::OutputType
typename Superclass::OutputType OutputType
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:80
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::IndexValueType
signed long IndexValueType
Definition: itkIntTypes.h:90
itkNeighborhoodOperatorImageFunction.h
itk::GaussianDerivativeOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
Definition: itkGaussianDerivativeOperator.h:106
itk::DiscreteGradientMagnitudeGaussianImageFunction::m_OperatorImageFunction
OperatorImageFunctionPointer m_OperatorImageFunction
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:240
itk::DiscreteGradientMagnitudeGaussianImageFunction::SetSigma
void SetSigma(const double sigma)
Definition: itkDiscreteGradientMagnitudeGaussianImageFunction.h:144