OTB  9.0.0
Orfeo Toolbox
otbMRFOptimizer.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 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
otb::MRFOptimizer::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMRFOptimizer.h:48
otb::MRFOptimizer::GetParameters
const ParametersType & GetParameters(void) const
Definition: otbMRFOptimizer.h:57
otb::MRFOptimizer::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMRFOptimizer.h:49
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MRFOptimizer::~MRFOptimizer
~MRFOptimizer() override
Definition: otbMRFOptimizer.h:78
otb::MRFOptimizer::m_NumberOfParameters
unsigned int m_NumberOfParameters
Definition: otbMRFOptimizer.h:81
otb::MRFOptimizer::SetParameters
virtual void SetParameters(const ParametersType &parameters)
Definition: otbMRFOptimizer.h:62
otb::MRFOptimizer::m_Parameters
ParametersType m_Parameters
Definition: otbMRFOptimizer.h:82
otb::MRFOptimizer::ParametersType
itk::Array< double > ParametersType
Definition: otbMRFOptimizer.h:50
otb::MRFOptimizer::Self
MRFOptimizer Self
Definition: otbMRFOptimizer.h:46
otb::MRFOptimizer::MRFOptimizer
MRFOptimizer()
Definition: otbMRFOptimizer.h:75
otb::MRFOptimizer
This is the base class for optimizer used in the MRF framework.
Definition: otbMRFOptimizer.h:43
otb::MRFOptimizer::Superclass
itk::Object Superclass
Definition: otbMRFOptimizer.h:47