OTB  9.0.0
Orfeo Toolbox
otbImageToHessianDeterminantImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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
otb::ImageToHessianDeterminantImageFilter::VectorType
itk::FixedArray< TPrecision, 3 > VectorType
Definition: otbImageToHessianDeterminantImageFilter.h:117
otb::Functor::HessianDeterminant::~HessianDeterminant
virtual ~HessianDeterminant()
Definition: otbImageToHessianDeterminantImageFilter.h:53
otb::ImageToHessianDeterminantImageFilter::ImageToHessianImageFilterPointerType
ImageToHessianImageFilterType::Pointer ImageToHessianImageFilterPointerType
Definition: otbImageToHessianDeterminantImageFilter.h:123
otb::ImageToHessianDeterminantImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageToHessianDeterminantImageFilter.h:96
otbImage.h
otb::ImageToHessianDeterminantImageFilter::VectorImageType
otb::Image< VectorType, 2 > VectorImageType
Definition: otbImageToHessianDeterminantImageFilter.h:118
otb::ImageToHessianDeterminantImageFilter::InputImagePointerType
InputImageType::Pointer InputImagePointerType
Definition: otbImageToHessianDeterminantImageFilter.h:112
otb::Functor::HessianDeterminant::operator!=
bool operator!=(const HessianDeterminant) const
Definition: otbImageToHessianDeterminantImageFilter.h:67
otb::ImageToHessianDeterminantImageFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbImageToHessianDeterminantImageFilter.h:114
otbImageToHessianDeterminantImageFilter.hxx
otbMath.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Image
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
otb::ImageToHessianDeterminantImageFilter::m_HessianFilter
ImageToHessianImageFilterPointerType m_HessianFilter
Definition: otbImageToHessianDeterminantImageFilter.h:151
otb::ImageToHessianDeterminantImageFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbImageToHessianDeterminantImageFilter.h:113
otb::ImageToHessianDeterminantImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbImageToHessianDeterminantImageFilter.h:97
otb::Functor::HessianDeterminant::HessianDeterminant
HessianDeterminant()
Definition: otbImageToHessianDeterminantImageFilter.h:50
otb::ImageToHessianDeterminantImageFilter::InputImageType
TInputImage InputImageType
Definition: otbImageToHessianDeterminantImageFilter.h:108
otb::Functor::HessianDeterminant::operator()
TOutput operator()(const TInput &input)
Definition: otbImageToHessianDeterminantImageFilter.h:62
otb::ImageToHessianDeterminantImageFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbImageToHessianDeterminantImageFilter.h:95
otb::ImageToHessianDeterminantImageFilter::DeterminantFilterType
itk::UnaryFunctorImageFilter< VectorImageType, OutputImageType, DeterminantFunctorType > DeterminantFilterType
Definition: otbImageToHessianDeterminantImageFilter.h:125
otb::ImageToHessianDeterminantImageFilter::ImageToHessianImageFilterType
itk::HessianRecursiveGaussianImageFilter< InputImageType, VectorImageType > ImageToHessianImageFilterType
Definition: otbImageToHessianDeterminantImageFilter.h:122
otb::Functor::HessianDeterminant
This functor computes the determinant of symmetric 2*2 matrix .
Definition: otbImageToHessianDeterminantImageFilter.h:47
otb::ImageToHessianDeterminantImageFilter::OutputPixelType
OutputImageType::PixelType OutputPixelType
Definition: otbImageToHessianDeterminantImageFilter.h:115
otb::ImageToHessianDeterminantImageFilter::m_DeterminantFilter
DeterminantFilterPointerType m_DeterminantFilter
Definition: otbImageToHessianDeterminantImageFilter.h:154
otb::Functor::HessianDeterminant::operator==
bool operator==(const HessianDeterminant &other) const
Definition: otbImageToHessianDeterminantImageFilter.h:72
otb::ImageToHessianDeterminantImageFilter::DeterminantFilterPointerType
DeterminantFilterType::Pointer DeterminantFilterPointerType
Definition: otbImageToHessianDeterminantImageFilter.h:126
otb::ImageToHessianDeterminantImageFilter::m_Sigma
double m_Sigma
Definition: otbImageToHessianDeterminantImageFilter.h:157
otb::ImageToHessianDeterminantImageFilter::Self
ImageToHessianDeterminantImageFilter Self
Definition: otbImageToHessianDeterminantImageFilter.h:94
otb::Image::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImage.h:97
otb::ImageToHessianDeterminantImageFilter::VectorImagePointerType
VectorImageType::Pointer VectorImagePointerType
Definition: otbImageToHessianDeterminantImageFilter.h:119
otb::ImageToHessianDeterminantImageFilter
This class compute the Hessian determinant of each pixel of an input image.
Definition: otbImageToHessianDeterminantImageFilter.h:89
otb::ImageToHessianDeterminantImageFilter::DeterminantFunctorType
Functor::HessianDeterminant< VectorType, OutputPixelType > DeterminantFunctorType
Definition: otbImageToHessianDeterminantImageFilter.h:124