ITK  6.0.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 #include <memory> // For unique_ptr.
27 
28 namespace itk
29 {
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_MOVE(MultipleValuedNonLinearVnlOptimizer);
43 
49 
51  itkOverrideGetNameOfClassMacro(MultipleValuedNonLinearVnlOptimizer);
52 
55  using ParametersType = Superclass::ParametersType;
56 
63  void
64  SetCostFunction(MultipleValuedCostFunction * costFunction) override = 0;
65 
69  void
70  SetUseCostFunctionGradient(bool);
71 
72  void
74  {
75  this->SetUseCostFunctionGradient(true);
76  }
77 
78  void
80  {
81  this->SetUseCostFunctionGradient(false);
82  }
83 
84  bool
85  GetUseCostFunctionGradient() const;
86 
93  itkGetConstReferenceMacro(CachedValue, MeasureType);
94  itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
95  itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
98 protected:
101 
102  void
103  PrintSelf(std::ostream & os, Indent indent) const override;
104 
106 
107  void
108  SetCostFunctionAdaptor(CostFunctionAdaptorType * adaptor);
109 
111  GetCostFunctionAdaptor() const;
112 
114  GetCostFunctionAdaptor();
115 
119  GetNonConstCostFunctionAdaptor() const;
120 
126 
127 private:
129  void
130  IterationReport(const EventObject & event);
131 
132  std::unique_ptr<CostFunctionAdaptorType> m_CostFunctionAdaptor;
133  bool m_UseGradient{};
134 
135  CommandType::Pointer m_Command{};
136 
137  mutable ParametersType m_CachedCurrentPosition{};
138  mutable MeasureType m_CachedValue{};
139  mutable DerivativeType m_CachedDerivative{};
140 };
141 } // end namespace itk
142 
143 #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::MultipleValuedNonLinearVnlOptimizer::m_CostFunctionAdaptor
std::unique_ptr< CostFunctionAdaptorType > m_CostFunctionAdaptor
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:132
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:79
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: itkAnatomicalOrientation.h:29
itk::EventObject
Abstraction of the Events used to communicating among filters and with GUIs.
Definition: itkEventObject.h:58
itk::MultipleValuedNonLinearVnlOptimizer
This class is a base for the Optimization methods that optimize a multi-valued function.
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:39
itkMultipleValuedNonLinearOptimizer.h
itkCommand.h
itk::MultipleValuedNonLinearVnlOptimizer::UseCostFunctionGradientOn
void UseCostFunctionGradientOn()
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:73