ITK  4.6.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 
26 namespace itk
27 {
28 /* Necessary forward declaration see below for definition */
37 template< typename TInternalVnlOptimizerType >
39 
71 template< typename TInternalVnlOptimizerType >
74 {
75 public:
81 
84 
88 
91 
94 
97 
100 
102  virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE;
103 
105  virtual void SetMetric(MetricType *metric) ITK_OVERRIDE;
106 
110  virtual void SetTrace(bool flag);
111 
112  itkGetConstMacro(Trace, bool);
113  itkBooleanMacro(Trace);
114 
116  virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n);
117 
118  itkGetConstMacro(MaximumNumberOfFunctionEvaluations, unsigned int);
119 
125  virtual void SetGradientConvergenceTolerance(double gtol);
126 
127  itkGetConstMacro(GradientConvergenceTolerance, double);
128 
130  virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE;
131 
132 protected:
134  virtual ~LBFGSOptimizerBasev4();
135  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
136 
138 
140 
142  InternalOptimizerAutoPointer m_VnlOptimizer;
143 
144  mutable std::ostringstream m_StopConditionDescription;
145 
146  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 &); //purposely not implemented
160  void operator=(const Self &); //purposely not implemented
161 
162 };
163 } // end namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkLBFGSOptimizerBasev4.hxx"
167 #endif
168 
169 #endif
Superclass::StopConditionDescriptionType StopConditionDescriptionType
LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType > InternalOptimizerType
Light weight base class for most itk classes.
virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE
Wrapper helper around vnl optimizer.
Superclass::ScalesType ScalesType
virtual void SetTrace(bool flag)
InternalOptimizerAutoPointer m_VnlOptimizer
InternalOptimizerType * GetOptimizer(void)
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.
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
Superclass::ParametersType ParametersType
SmartPointer< const Self > ConstPointer
Superclass::StopConditionReturnStringType StopConditionReturnStringType
Implements an Automatic Pointer to an object.
virtual void SetMetric(MetricType *metric) ITK_OVERRIDE
Superclass::StopConditionReturnStringType StopConditionReturnStringType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void StartOptimization(bool doOnlyInitialization=false) ITK_OVERRIDE
Superclass::StopConditionDescriptionType StopConditionDescriptionType
Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework. ...
SingleValuedNonLinearVnlOptimizerv4 Superclass
virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n)