ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkLBFGSOptimizerBasev4.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 itkLBFGSOptimizerBasev4_h
19 #define itkLBFGSOptimizerBasev4_h
20 
22 #include "vnl/algo/vnl_lbfgs.h"
23 #include "vnl/algo/vnl_lbfgsb.h"
24 #include "itkAutoPointer.h"
25 #include "ITKOptimizersv4Export.h"
26 
27 namespace itk
28 {
29 /* Necessary forward declaration see below for definition */
38 template< typename TInternalVnlOptimizerType >
40 
72 template< typename TInternalVnlOptimizerType >
75 {
76 public:
82 
85 
89 
92 
95 
98 
101 
103  virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE;
104 
106  virtual void SetMetric(MetricType *metric) ITK_OVERRIDE;
107 
111  virtual void SetTrace(bool flag);
112 
113  itkGetConstMacro(Trace, bool);
114  itkBooleanMacro(Trace);
115 
117  virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n);
118 
119  itkGetConstMacro(MaximumNumberOfFunctionEvaluations, unsigned int);
120 
126  virtual void SetGradientConvergenceTolerance(double gtol);
127 
128  itkGetConstMacro(GradientConvergenceTolerance, double);
129 
131  virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE;
132 
133 protected:
135  virtual ~LBFGSOptimizerBasev4();
136  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
137 
139 
141 
143  InternalOptimizerAutoPointer m_VnlOptimizer;
144 
145  mutable std::ostringstream m_StopConditionDescription;
146 
147  bool m_Trace;
152 
153  // give the helper access to member variables, to update iteration
154  // counts, etc.
155  friend class LBFGSOptimizerBaseHelperv4<TInternalVnlOptimizerType>;
157 
158 private:
159  LBFGSOptimizerBasev4(const Self &) ITK_DELETE_FUNCTION;
160  void operator=(const Self &) ITK_DELETE_FUNCTION;
161 
162 };
163 } // end namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkLBFGSOptimizerBasev4.hxx"
167 #endif
168 
169 #endif
InternalOptimizerType * GetOptimizer()
Superclass::StopConditionDescriptionType StopConditionDescriptionType
LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType > InternalOptimizerType
Light weight base class for most itk classes.
Wrapper helper around vnl optimizer.
Superclass::ScalesType ScalesType
virtual void SetTrace(bool flag)
InternalOptimizerAutoPointer m_VnlOptimizer
Wrapper helper around vnl_lbfgsb.
Superclass::MetricType MetricType
std::ostringstream m_StopConditionDescription
virtual void SetGradientConvergenceTolerance(double gtol)
This class is an Adaptor that allows to pass itk::ObjectToObjectMetricBase objects to vnl_optimizers ...
This is a base for the ITKv4 Optimization methods using the vnl library.
Superclass::ParametersType ParametersType
SmartPointer< const Self > ConstPointer
virtual void SetMetric(MetricType *metric) override
virtual void StartOptimization(bool doOnlyInitialization=false) override
virtual const StopConditionReturnStringType GetStopConditionDescription() const override
Superclass::StopConditionReturnStringType StopConditionReturnStringType
Implements an Automatic Pointer to an object.
Superclass::StopConditionReturnStringType StopConditionReturnStringType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::StopConditionDescriptionType StopConditionDescriptionType
Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework. ...
SingleValuedNonLinearVnlOptimizerv4 Superclass
virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n)
virtual void PrintSelf(std::ostream &os, Indent indent) const override