ITK  6.0.0
Insight Toolkit
itkSingleValuedVnlCostFunctionAdaptorv4.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 itkSingleValuedVnlCostFunctionAdaptorv4_h
19#define itkSingleValuedVnlCostFunctionAdaptorv4_h
20
23#include "vnl/vnl_cost_function.h"
24
25namespace itk
26{
37class SingleValuedVnlCostFunctionAdaptorv4 : public vnl_cost_function
38{
39public:
40
42 using InternalMeasureType = double;
43
45 using InternalParametersType = vnl_vector<InternalMeasureType>;
46
48 using InternalDerivativeType = vnl_vector<InternalMeasureType>;
49
52
55
58
61
63 SingleValuedVnlCostFunctionAdaptorv4(unsigned int spaceDimension);
64
66 void
68 {
69 m_ObjectMetric = costFunction;
70 }
71
75 {
76 return m_ObjectMetric;
77 }
78
81 f(const InternalParametersType & inparameters) override;
82
84 void
85 gradf(const InternalParametersType & inparameters, InternalDerivativeType & gradient) override;
86
88 void
90
92 void
94
96 void
97 SetScales(const ScalesType & scales);
98
103 unsigned long
104 AddObserver(const EventObject & event, Command *) const;
105
110 itkGetConstReferenceMacro(CachedValue, MeasureType);
111
112 itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
113
115 const ParametersType &
117
118protected:
121 void
122 ReportIteration(const EventObject & event) const;
123
124private:
129
132
133}; // end of Class CostFunction
134
135} // end namespace itk
136
137#endif
Superclass for callback/observer methods.
Definition: itkCommand.h:46
OptimizerParameters< double > ParametersType
Abstraction of the Events used to communicating among filters and with GUIs.
This class is an Adaptor that allows to pass itk::ObjectToObjectMetricBase objects to vnl_optimizers ...
void ReportIteration(const EventObject &event) const
const ObjectToObjectMetricBase * GetCostFunction() const
const ParametersType & GetCachedCurrentParameters() const
void compute(const InternalParametersType &x, InternalMeasureType *fun, InternalDerivativeType *g) override
InternalMeasureType f(const InternalParametersType &inparameters) override
unsigned long AddObserver(const EventObject &event, Command *) const
SingleValuedVnlCostFunctionAdaptorv4(unsigned int spaceDimension)
void gradf(const InternalParametersType &inparameters, InternalDerivativeType &gradient) override
void SetCostFunction(ObjectToObjectMetricBase *costFunction)
void ConvertExternalToInternalGradient(const DerivativeType &input, InternalDerivativeType &output) const
void SetScales(const ScalesType &scales)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....