ITK  6.0.0
Insight Toolkit
itkSingleValuedNonLinearVnlOptimizer.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 itkSingleValuedNonLinearVnlOptimizer_h
19#define itkSingleValuedNonLinearVnlOptimizer_h
20
23#include "itkCommand.h"
24#include "ITKOptimizersExport.h"
25
26#include <memory> // For unique_ptr.
27
28namespace itk
29{
40{
41public:
42 ITK_DISALLOW_COPY_AND_MOVE(SingleValuedNonLinearVnlOptimizer);
43
49
51 itkOverrideGetNameOfClassMacro(SingleValuedNonLinearVnlOptimizer);
52
58
65 void
66 SetCostFunction(SingleValuedCostFunction * costFunction) override = 0;
67
73 itkGetConstReferenceMacro(Maximize, bool);
74 itkSetMacro(Maximize, bool);
75 itkBooleanMacro(Maximize);
76 bool
78 {
79 return !m_Maximize;
80 }
81 void
83 {
84 this->SetMaximize(!v);
85 }
86 void
88 {
89 this->MaximizeOff();
90 }
91 void
93 {
94 this->MaximizeOn();
95 }
103 itkGetConstReferenceMacro(CachedValue, MeasureType);
104 itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
105 itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
111 virtual bool
113 {
114 return true;
115 }
116
117protected:
120
122
123 void
125
128
131
136
138 void
139 PrintSelf(std::ostream & os, Indent indent) const override;
140
141private:
143 void
145
146 std::unique_ptr<CostFunctionAdaptorType> m_CostFunctionAdaptor;
147
148 bool m_Maximize{};
149
151
152 mutable ParametersType m_CachedCurrentPosition{};
153 mutable MeasureType m_CachedValue{};
154 mutable DerivativeType m_CachedDerivative{};
155};
156} // end namespace itk
157
158#endif
Array class with size defined at construction time.
Definition: itkArray.h:48
Abstraction of the Events used to communicating among filters and with GUIs.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A Command subclass that calls a pointer to a member function.
Definition: itkCommand.h:165
This class is a base for the CostFunctions returning a single value.
This class is a base for the Optimization methods that optimize a single valued function.
This class is a base for the Optimization methods that optimize a single valued function.
void PrintSelf(std::ostream &os, Indent indent) const override
const CostFunctionAdaptorType * GetCostFunctionAdaptor() const
void IterationReport(const EventObject &event)
void SetCostFunction(SingleValuedCostFunction *costFunction) override=0
CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor() const
std::unique_ptr< CostFunctionAdaptorType > m_CostFunctionAdaptor
CostFunctionAdaptorType * GetCostFunctionAdaptor()
void SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor)
This class is an Adaptor that allows to pass itk::SingleValuedCostFunctions to vnl_optimizers expecti...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....