Orfeo Toolbox  4.0
otbMRFEnergyPotts.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 
19 #ifndef __otbMRFEnergyPotts_h
20 #define __otbMRFEnergyPotts_h
21 
22 #include "otbMRFEnergy.h"
23 
24 namespace otb
25 {
44 template<class TInput1, class TInput2>
45 class ITK_EXPORT MRFEnergyPotts : public MRFEnergy<TInput1, TInput2>
46 {
47 public:
52 
53  typedef TInput1 InputImageType;
54  typedef TInput2 LabelledImageType;
55  typedef typename InputImageType::PixelType InputImagePixelType;
56  typedef typename LabelledImageType::PixelType LabelledImagePixelType;
57 
59 
60  itkTypeMacro(MRFEnergyPotts, MRFEnergy);
61 
62  itkNewMacro(Self);
63 
64  double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2)
65  {
66  if (value1 != value2)
67  {
68  return this->m_Parameters[0];
69  }
70  else
71  {
72  return -this->m_Parameters[0];
73  }
74  }
75 
76 protected:
77  // The constructor and destructor.
79  {
80  this->m_NumberOfParameters = 1;
81  this->m_Parameters.SetSize(this->m_NumberOfParameters);
82  this->m_Parameters[0] = 1.0;
83  };
84  virtual ~MRFEnergyPotts() {}
85 
86 };
87 }
88 
89 #endif

Generated at Sat Mar 8 2014 16:09:25 for Orfeo Toolbox with doxygen 1.8.3.1