OTB  10.0.0
Orfeo Toolbox
otbMRFOptimizer.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 otbMRFOptimizer_h
22 #define otbMRFOptimizer_h
23 
24 #include "itkObject.h"
25 #include "itkObjectFactory.h"
26 #include "itkArray.h"
27 
28 namespace otb
29 {
43 class ITK_EXPORT MRFOptimizer : public itk::Object
44 {
45 public:
46  typedef MRFOptimizer Self;
47  typedef itk::Object Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50  typedef itk::Array<double> ParametersType;
51 
52  itkTypeMacro(MRFOptimizer, itk::Object);
53 
54  itkGetConstMacro(NumberOfParameters, unsigned int);
55 
56  // Get the parameters
57  const ParametersType& GetParameters(void) const
58  {
59  return this->m_Parameters;
60  }
61 
62  virtual void SetParameters(const ParametersType& parameters)
63  {
64  if (parameters.GetSize() != m_NumberOfParameters)
65  {
66  itkExceptionMacro(<< "Invalid number of parameters (" << parameters.GetSize() << " , " << m_NumberOfParameters << ")");
67  }
68  m_Parameters = parameters;
69  this->Modified();
70  }
71 
72  virtual bool Compute(double deltaEnergy) = 0;
73 
74 protected:
75  MRFOptimizer() : m_NumberOfParameters(1), m_Parameters(1)
76  {
77  }
78  ~MRFOptimizer() override
79  {
80  }
81  unsigned int m_NumberOfParameters;
83 };
84 }
85 
86 #endif
This is the base class for optimizer used in the MRF framework.
~MRFOptimizer() override
virtual bool Compute(double deltaEnergy)=0
const ParametersType & GetParameters(void) const
itk::SmartPointer< const Self > ConstPointer
virtual void SetParameters(const ParametersType &parameters)
ParametersType m_Parameters
MRFOptimizer Self
itk::Object Superclass
unsigned int m_NumberOfParameters
itk::Array< double > ParametersType
itk::SmartPointer< Self > Pointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.