ITK  6.0.0
Insight Toolkit
itkSingleValuedNonLinearVnlOptimizerv4.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 itkSingleValuedNonLinearVnlOptimizerv4_h
19 #define itkSingleValuedNonLinearVnlOptimizerv4_h
20 
21 #include "ITKOptimizersv4Export.h"
22 
25 #include "itkCommand.h"
26 
27 #include <memory> // For unique_ptr.
28 
29 namespace itk
30 {
40 class ITKOptimizersv4_EXPORT SingleValuedNonLinearVnlOptimizerv4 : public ObjectToObjectOptimizerBaseTemplate<double>
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(SingleValuedNonLinearVnlOptimizerv4);
44 
50 
52  itkOverrideGetNameOfClassMacro(SingleValuedNonLinearVnlOptimizerv4);
53 
59 
60  using MetricType = Superclass::MetricType;
61  using DerivativeType = Superclass::DerivativeType;
62  using ParametersType = Superclass::ParametersType;
63  using ScalesType = Superclass::ScalesType;
64 
66  using StopConditionReturnStringType = Superclass::StopConditionReturnStringType;
67 
69  using StopConditionDescriptionType = Superclass::StopConditionDescriptionType;
70 
71  void
72  StartOptimization(bool doOnlyInitialization = false) override;
73 
80  void
81  SetMetric(MetricType * metric) override = 0;
82 
88  itkGetConstReferenceMacro(CachedDerivative, DerivativeType);
89  itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType);
94  GetStopConditionDescription() const override = 0;
95 
96 protected:
99 
101 
102  void
103  SetCostFunctionAdaptor(CostFunctionAdaptorType * adaptor);
104 
106  GetCostFunctionAdaptor() const;
107 
109  GetCostFunctionAdaptor();
110 
114  GetNonConstCostFunctionAdaptor() const;
115 
117  void
118  PrintSelf(std::ostream & os, Indent indent) const override;
119 
120 private:
127  void
128  IterationReport(const EventObject & event);
129 
130  std::unique_ptr<CostFunctionAdaptorType> m_CostFunctionAdaptor;
131 
132  CommandType::Pointer m_Command{};
133 
134  mutable ParametersType m_CachedCurrentPosition{};
135  mutable DerivativeType m_CachedDerivative{};
136 };
137 } // end namespace itk
138 
139 #endif
itk::SingleValuedNonLinearVnlOptimizerv4::MetricType
Superclass::MetricType MetricType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:60
itk::SingleValuedNonLinearVnlOptimizerv4::m_CostFunctionAdaptor
std::unique_ptr< CostFunctionAdaptorType > m_CostFunctionAdaptor
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:130
itk::SingleValuedNonLinearVnlOptimizerv4::ScalesType
Superclass::ScalesType ScalesType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:63
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::SingleValuedNonLinearVnlOptimizerv4
This is a base for the ITKv4 Optimization methods using the vnl library.
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:40
itk::ObjectToObjectOptimizerBase
ObjectToObjectOptimizerBaseTemplate< double > ObjectToObjectOptimizerBase
Definition: itkObjectToObjectOptimizerBase.h:327
itk::SingleValuedNonLinearVnlOptimizerv4::StopConditionReturnStringType
Superclass::StopConditionReturnStringType StopConditionReturnStringType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:66
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::SingleValuedNonLinearVnlOptimizerv4::StopConditionDescriptionType
Superclass::StopConditionDescriptionType StopConditionDescriptionType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:69
itk::SingleValuedNonLinearVnlOptimizerv4::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:61
itk::SingleValuedVnlCostFunctionAdaptorv4
This class is an Adaptor that allows to pass itk::ObjectToObjectMetricBase objects to vnl_optimizers ...
Definition: itkSingleValuedVnlCostFunctionAdaptorv4.h:37
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itkObjectToObjectOptimizerBase.h
itk::ObjectToObjectOptimizerBaseTemplate
Abstract base for object-to-object optimizers.
Definition: itkObjectToObjectOptimizerBase.h:113
itk::EventObject
Abstraction of the Events used to communicating among filters and with GUIs.
Definition: itkEventObject.h:58
itk::SingleValuedNonLinearVnlOptimizerv4::ParametersType
Superclass::ParametersType ParametersType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:62
itkCommand.h
itkSingleValuedVnlCostFunctionAdaptorv4.h