OTB  10.0.0
Orfeo Toolbox
otbImageToHessianDeterminantImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbImageToHessianDeterminantImageFilter_h
22 #define otbImageToHessianDeterminantImageFilter_h
23 
24 #include "itkProcessObject.h"
25 #include "itkImageToImageFilter.h"
26 #include "itkHessianRecursiveGaussianImageFilter.h"
27 #include "itkUnaryFunctorImageFilter.h"
28 #include "otbImage.h"
29 #include "itkFixedArray.h"
30 #include "otbMath.h"
31 
32 namespace otb
33 {
34 namespace Functor
35 {
46 template <class TInput, class TOutput>
48 {
49 public:
51  {
52  }
54  {
55  }
56 
57  /*
58  *
59  * \param input : A symmetric Hessian Matrix
60  * \return Determinant of the Hessian Matrix
61  */
62  inline TOutput operator()(const TInput& input)
63  {
64  return static_cast<TOutput>(input[0] * input[1] - input[2] * input[2]);
65  }
66 
67  bool operator!=(const HessianDeterminant) const
68  {
69  return false;
70  }
71 
72  bool operator==(const HessianDeterminant& other) const
73  {
74  return !(*this != other);
75  }
76 };
77 }
88 template <class TInputImage, class TOutputImage, class TPrecision = double>
89 class ITK_EXPORT ImageToHessianDeterminantImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
90 {
91 
92 public:
95  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
96  typedef itk::SmartPointer<Self> Pointer;
97  typedef itk::SmartPointer<const Self> ConstPointer;
98 
100  itkNewMacro(Self);
101 
103  itkSetMacro(Sigma, double);
104  itkGetMacro(Sigma, double);
106 
108  itkTypeMacro(ImageToHessianDeterminantImageFilter, ImageToImageFilter);
109 
110  /* Initialization of Input & Output Images*/
111  typedef TInputImage InputImageType;
112  typedef typename InputImageType::Pointer InputImagePointerType;
113  typedef TOutputImage OutputImageType;
114  typedef typename OutputImageType::Pointer OutputImagePointerType;
115  typedef typename OutputImageType::PixelType OutputPixelType;
116 
117  typedef itk::FixedArray<TPrecision, 3> VectorType;
120 
122  typedef itk::HessianRecursiveGaussianImageFilter<InputImageType, VectorImageType> ImageToHessianImageFilterType;
123  typedef typename ImageToHessianImageFilterType::Pointer ImageToHessianImageFilterPointerType;
125  typedef itk::UnaryFunctorImageFilter<VectorImageType, OutputImageType, DeterminantFunctorType> DeterminantFilterType;
126  typedef typename DeterminantFilterType::Pointer DeterminantFilterPointerType;
127 
128 protected:
133 
138 
142  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
143 
147  void GenerateData() override;
148 
149 private:
152 
155 
157  double m_Sigma;
158 };
159 }
160 #ifndef OTB_MANUAL_INSTANTIATION
162 #endif
163 
164 #endif
This functor computes the determinant of symmetric 2*2 matrix .
bool operator!=(const HessianDeterminant) const
bool operator==(const HessianDeterminant &other) const
This class compute the Hessian determinant of each pixel of an input image.
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
itk::UnaryFunctorImageFilter< VectorImageType, OutputImageType, DeterminantFunctorType > DeterminantFilterType
Functor::HessianDeterminant< VectorType, OutputPixelType > DeterminantFunctorType
ImageToHessianImageFilterType::Pointer ImageToHessianImageFilterPointerType
itk::HessianRecursiveGaussianImageFilter< InputImageType, VectorImageType > ImageToHessianImageFilterType
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:92
itk::SmartPointer< Self > Pointer
Definition: otbImage.h:97
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.