ITK  5.4.0
Insight Toolkit
itkMultipleValuedNonLinearVnlOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMultipleValuedNonLinearVnlOptimizer_h
19 #define itkMultipleValuedNonLinearVnlOptimizer_h
20 
23 #include "itkCommand.h"
24 #include "ITKOptimizersExport.h"
25 
26 namespace itk
27 {
38 {
39 public:
40  ITK_DISALLOW_COPY_AND_MOVE(MultipleValuedNonLinearVnlOptimizer);
41 
47 
49  itkOverrideGetNameOfClassMacro(MultipleValuedNonLinearVnlOptimizer);
50 
53  using ParametersType = Superclass::ParametersType;
54 
61  void
62  SetCostFunction(MultipleValuedCostFunction * costFunction) override = 0;
63 
67  void
68  SetUseCostFunctionGradient(bool);
69 
70  void
72  {
73  this->SetUseCostFunctionGradient(true);
74  }
75 
76  void
78  {
79  this->SetUseCostFunctionGradient(false);
80  }
81 
82  bool
83  GetUseCostFunctionGradient() const;
84 
91  itkGetConstReferenceMacro(CachedValue, MeasureType);
92  itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
93  itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
96 protected:
99 
100  void
101  PrintSelf(std::ostream & os, Indent indent) const override;
102 
104 
105  void
106  SetCostFunctionAdaptor(CostFunctionAdaptorType * adaptor);
107 
109  GetCostFunctionAdaptor() const;
110 
112  GetCostFunctionAdaptor();
113 
117  GetNonConstCostFunctionAdaptor() const;
118 
124 
125 private:
127  void
128  IterationReport(const EventObject & event);
129 
130  CostFunctionAdaptorType * m_CostFunctionAdaptor{};
131  bool m_UseGradient{};
132 
133  CommandType::Pointer m_Command{};
134 
135  mutable ParametersType m_CachedCurrentPosition{};
136  mutable MeasureType m_CachedValue{};
137  mutable DerivativeType m_CachedDerivative{};
138 };
139 } // end namespace itk
140 
141 #endif
itk::MultipleValuedCostFunction
This class is a base for the CostFunctions returning a multiple values.
Definition: itkMultipleValuedCostFunction.h:35
itk::OptimizerParameters< double >
itkMultipleValuedVnlCostFunctionAdaptor.h
itk::MultipleValuedNonLinearOptimizer
This class is a base for the Optimization methods that optimize a multiple valued function.
Definition: itkMultipleValuedNonLinearOptimizer.h:34
itk::ReceptorMemberCommand
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:164
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MultipleValuedNonLinearVnlOptimizer::UseCostFunctionGradientOff
void UseCostFunctionGradientOff()
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:77
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::MultipleValuedVnlCostFunctionAdaptor
This class is an Adaptor that allows to pass itk::MultipleValuedCostFunctions to vnl_optimizers expec...
Definition: itkMultipleValuedVnlCostFunctionAdaptor.h:37
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::EventObject
Abstraction of the Events used to communicating among filters and with GUIs.
Definition: itkEventObject.h:57
itk::MultipleValuedNonLinearVnlOptimizer
This class is a base for the Optimization methods that optimize a multi-valued function.
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:37
itkMultipleValuedNonLinearOptimizer.h
itkCommand.h
itk::MultipleValuedNonLinearVnlOptimizer::UseCostFunctionGradientOn
void UseCostFunctionGradientOn()
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:71