OTB  9.0.0
Orfeo Toolbox
otbMRFEnergyPotts.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 
22 #ifndef otbMRFEnergyPotts_h
23 #define otbMRFEnergyPotts_h
24 
25 #include "otbMRFEnergy.h"
26 
27 namespace otb
28 {
49 
50 template <class TInput1, class TInput2>
51 class ITK_EXPORT MRFEnergyPotts : public MRFEnergy<TInput1, TInput2>
52 {
53 public:
56  typedef itk::SmartPointer<Self> Pointer;
57  typedef itk::SmartPointer<const Self> ConstPointer;
58 
59  typedef TInput1 InputImageType;
60  typedef TInput2 LabelledImageType;
61  typedef typename InputImageType::PixelType InputImagePixelType;
62  typedef typename LabelledImageType::PixelType LabelledImagePixelType;
63 
64  typedef itk::Array<double> ParametersType;
65 
66  itkTypeMacro(MRFEnergyPotts, MRFEnergy);
67 
68  itkNewMacro(Self);
69 
70  double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) override
71  {
72  if (value1 != value2)
73  {
74  return this->m_Parameters[0];
75  }
76  else
77  {
78  return -this->m_Parameters[0];
79  }
80  }
81 
82 protected:
83  // The constructor and destructor.
85  {
86  this->m_NumberOfParameters = 1;
87  this->m_Parameters.SetSize(this->m_NumberOfParameters);
88  this->m_Parameters[0] = 1.0;
89  };
90  ~MRFEnergyPotts() override
91  {
92  }
93 };
94 }
95 
96 #endif
otb::MRFEnergyPotts::GetSingleValue
double GetSingleValue(const InputImagePixelType &value1, const LabelledImagePixelType &value2) override
Definition: otbMRFEnergyPotts.h:70
otb::MRFEnergyPotts
This is the implementation of the Potts model for Markov classification.
Definition: otbMRFEnergyPotts.h:51
otb::MRFEnergyPotts::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMRFEnergyPotts.h:57
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbMRFEnergy.h
otb::MRFEnergyPotts::ParametersType
itk::Array< double > ParametersType
Definition: otbMRFEnergyPotts.h:64
otb::MRFEnergyPotts::Superclass
MRFEnergy< TInput1, TInput2 > Superclass
Definition: otbMRFEnergyPotts.h:55
otb::MRFEnergyPotts::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbMRFEnergyPotts.h:61
otb::MRFEnergyPotts::InputImageType
TInput1 InputImageType
Definition: otbMRFEnergyPotts.h:59
otb::MRFEnergyPotts::MRFEnergyPotts
MRFEnergyPotts()
Definition: otbMRFEnergyPotts.h:84
otb::MRFEnergy::LabelledImagePixelType
LabelledImageType::PixelType LabelledImagePixelType
Definition: otbMRFEnergy.h:54
otb::MRFEnergy::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbMRFEnergy.h:53
otb::MRFEnergyPotts::LabelledImageType
TInput2 LabelledImageType
Definition: otbMRFEnergyPotts.h:60
otb::MRFEnergyPotts::LabelledImagePixelType
LabelledImageType::PixelType LabelledImagePixelType
Definition: otbMRFEnergyPotts.h:62
otb::MRFEnergy
This is the base class for energy function used in the MRF framework.
Definition: otbMRFEnergy.h:43
otb::MRFEnergyPotts::Self
MRFEnergyPotts Self
Definition: otbMRFEnergyPotts.h:54
otb::MRFEnergyPotts::~MRFEnergyPotts
~MRFEnergyPotts() override
Definition: otbMRFEnergyPotts.h:90
otb::MRFEnergyPotts::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMRFEnergyPotts.h:56