ITK  5.3.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  * 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 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 
66 
68  using InputImageType = typename Superclass::InputImageType;
69  using InputPixelType = typename Superclass::InputPixelType;
70  using IndexType = typename Superclass::IndexType;
72  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
73  using PointType = typename Superclass::PointType;
74 
76  static constexpr unsigned int ImageDimension2 = InputImageType::ImageDimension;
77 
79  using OutputType = 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);
129 
131  virtual void
132  SetVariance(double variance)
133  {
134  m_Variance.Fill(variance);
135  this->Modified();
136  }
138 
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);
157 
159  itkSetMacro(Order, OrderArrayType);
160  itkGetConstMacro(Order, const OrderArrayType);
161  itkSetVectorMacro(Order, unsigned int, OrderArrayType::Length);
163 
165  virtual void
166  SetOrder(unsigned int order)
167  {
168  m_Order.Fill(order);
169  this->Modified();
170  }
172 
176  itkSetMacro(NormalizeAcrossScale, bool);
177  itkGetConstMacro(NormalizeAcrossScale, bool);
178  itkBooleanMacro(NormalizeAcrossScale);
180 
182  itkSetMacro(UseImageSpacing, bool);
183  itkGetConstMacro(UseImageSpacing, bool);
184  itkBooleanMacro(UseImageSpacing);
186 
191  itkSetMacro(MaximumKernelWidth, unsigned int);
192  itkGetConstMacro(MaximumKernelWidth, unsigned int);
194 
196  itkSetEnumMacro(InterpolationMode, InterpolationModeEnum);
197  itkGetEnumMacro(InterpolationMode, InterpolationModeEnum);
199 
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:
234 
237 
240  double m_MaximumError{ 0.005 };
241 
245  unsigned int m_MaximumKernelWidth{ 30 };
246 
249 
253 
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
itk::DiscreteGaussianDerivativeImageFunction::m_DerivativeKernel
KernelType m_DerivativeKernel
Definition: itkDiscreteGaussianDerivativeImageFunction.h:252
itk::DiscreteGaussianDerivativeImageFunction::m_OperatorImageFunction
OperatorImageFunctionPointer m_OperatorImageFunction
Definition: itkDiscreteGaussianDerivativeImageFunction.h:255
itk::DiscreteGaussianDerivativeImageFunction::OutputType
typename Superclass::OutputType OutputType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:79
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Neighborhood< TOutput, Self::ImageDimension2 >
InterpolationMode
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::DiscreteGaussianDerivativeImageFunction::m_Variance
VarianceArrayType m_Variance
Definition: itkDiscreteGaussianDerivativeImageFunction.h:233
itk::GaussianDerivativeOperatorEnums::InterpolationMode
InterpolationMode
Definition: itkGaussianDerivativeOperator.h:43
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:59
itk::DiscreteGaussianDerivativeImageFunction::IndexValueType
typename Superclass::IndexValueType IndexValueType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:71
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::m_OperatorArray
GaussianDerivativeOperatorArrayType m_OperatorArray
Definition: itkDiscreteGaussianDerivativeImageFunction.h:248
itk::DiscreteGaussianDerivativeImageFunction::SetOrder
virtual void SetOrder(unsigned int order)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:166
itk::FixedArray< double, Self::ImageDimension2 >
itk::DiscreteGaussianDerivativeImageFunction::m_Order
OrderArrayType m_Order
Definition: itkDiscreteGaussianDerivativeImageFunction.h:236
itk::DiscreteGaussianDerivativeImageFunction
Compute the discrete gaussian derivatives of an the image at a specific location in space,...
Definition: itkDiscreteGaussianDerivativeImageFunction.h:47
itk::DiscreteGaussianDerivativeImageFunction::InputImageType
typename Superclass::InputImageType InputImageType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:68
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
itk::DiscreteGaussianDerivativeImageFunction::InputPixelType
typename Superclass::InputPixelType InputPixelType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:69
itkNeighborhoodOperatorImageFunction.h
itk::DiscreteGaussianDerivativeImageFunction::ContinuousIndexType
typename Superclass::ContinuousIndexType ContinuousIndexType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:72
itk::DiscreteGaussianDerivativeImageFunction::Initialize
virtual void Initialize()
Definition: itkDiscreteGaussianDerivativeImageFunction.h:211
itk::DiscreteGaussianDerivativeImageFunction::IndexType
typename Superclass::IndexType IndexType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:70
itk::GaussianDerivativeOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
Definition: itkGaussianDerivativeOperator.h:106
itk::DiscreteGaussianDerivativeImageFunction::DiscreteGaussianDerivativeImageFunction
DiscreteGaussianDerivativeImageFunction(const Self &)
Definition: itkDiscreteGaussianDerivativeImageFunction.h:218
itk::DiscreteGaussianDerivativeImageFunction::PointType
typename Superclass::PointType PointType
Definition: itkDiscreteGaussianDerivativeImageFunction.h:73