OTB  10.0.0
Orfeo Toolbox
otbMRFEnergyGaussian.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 
22 #ifndef otbMRFEnergyGaussian_h
23 #define otbMRFEnergyGaussian_h
24 
25 #include "otbMRFEnergy.h"
26 
27 #include "otbMath.h"
28 #include "vcl_legacy_aliases.h"
29 
30 namespace otb
31 {
52 template <class TInput1, class TInput2>
53 class ITK_EXPORT MRFEnergyGaussian : public MRFEnergy<TInput1, TInput2>
54 {
55 public:
58  typedef itk::SmartPointer<Self> Pointer;
59  typedef itk::SmartPointer<const Self> ConstPointer;
60 
61  typedef TInput1 InputImageType;
62  typedef TInput2 LabelledImageType;
63  typedef typename InputImageType::PixelType InputImagePixelType;
64  typedef typename LabelledImageType::PixelType LabelledImagePixelType;
65 
66  typedef itk::Array<double> ParametersType;
67 
68  itkTypeMacro(MRFEnergyGaussian, MRFEnergy);
69 
70  itkNewMacro(Self);
71 
72  double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override
73  {
74  return vnl_math_sqr((static_cast<double>(value1)) - (static_cast<double>(value2)));
75  }
76 
77 protected:
78  // The constructor and destructor.
80  {
81  this->m_NumberOfParameters = 0;
82  this->m_Parameters.SetSize(this->m_NumberOfParameters);
83  };
84  ~MRFEnergyGaussian() override
85  {
86  }
87 };
88 }
89 
90 #endif
This is the implementation of the Gaussian model for Markov classification.
itk::SmartPointer< const Self > ConstPointer
MRFEnergy< TInput1, TInput2 > Superclass
LabelledImageType::PixelType LabelledImagePixelType
double GetSingleValue(const InputImagePixelType &value1, const LabelledImagePixelType &value2) override
InputImageType::PixelType InputImagePixelType
itk::SmartPointer< Self > Pointer
itk::Array< double > ParametersType
This is the base class for energy function used in the MRF framework.
Definition: otbMRFEnergy.h:44
InputImageType::PixelType InputImagePixelType
Definition: otbMRFEnergy.h:53
LabelledImageType::PixelType LabelledImagePixelType
Definition: otbMRFEnergy.h:54
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.