ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLBFGSOptimizerv4.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 itkLBFGSOptimizerv4_h
19 #define itkLBFGSOptimizerv4_h
20 
22 #include "vnl/algo/vnl_lbfgs.h"
23 #include "ITKOptimizersv4Export.h"
24 
25 namespace itk
26 {
85 class ITKOptimizersv4_EXPORT LBFGSOptimizerv4:
86  public LBFGSOptimizerBasev4< vnl_lbfgs >
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_ASSIGN(LBFGSOptimizerv4);
90 
96 
97  using MetricType = Superclass::MetricType;
98  using ParametersType = Superclass::ParametersType;
99  using ScalesType = Superclass::ScalesType;
100 
102  itkNewMacro(Self);
103 
105  itkTypeMacro(LBFGSOptimizerv4, Superclass);
106 
108  void StartOptimization(bool doOnlyInitialization = false) override;
109 
111  void SetMetric(MetricType *metric) override;
112 
113  void VerboseOn();
114  void VerboseOff();
115 
122  void SetLineSearchAccuracy(double tol);
123 
124  itkGetConstMacro(LineSearchAccuracy, double);
125 
130  void SetDefaultStepLength(double stp);
131 
132  itkGetConstMacro(DefaultStepLength, double);
133 
134 protected:
136  ~LBFGSOptimizerv4() override;
137  void PrintSelf(std::ostream & os, Indent indent) const override;
138 
140  using InternalParametersType = vnl_vector< double >;
141 
143  using InternalOptimizerType = vnl_lbfgs;
144 
145 private:
146  bool m_Verbose{false};
147  double m_LineSearchAccuracy{0.9};
148  double m_DefaultStepLength{1.0};
149 };
150 } // end namespace itk
151 #endif
Light weight base class for most itk classes.
Superclass::MetricType MetricType
Superclass::ParametersType ParametersType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework. ...
Wrap of the vnl_lbfgs algorithm for use in ITKv4 registration framework. The vnl_lbfgs is a wrapper f...
vnl_vector< double > InternalParametersType
Superclass::ScalesType ScalesType