ITK  4.5.0
Insight Segmentation and Registration Toolkit
itkQuasiNewtonOptimizerv4.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 __itkQuasiNewtonOptimizerv4_h
19 #define __itkQuasiNewtonOptimizerv4_h
20 
21 #include "itkArray2D.h"
23 
24 #include "vnl/algo/vnl_matrix_inverse.h"
25 #include "vnl/algo/vnl_determinant.h"
26 
27 namespace itk
28 {
58 template<typename TInternalComputationValueType>
60  public GradientDescentOptimizerv4Template<TInternalComputationValueType>
61 {
62 public:
68 
70  itkNewMacro(Self);
71 
74 
76  typedef TInternalComputationValueType InternalComputationValueType;
77 
83 
86 
88  typedef std::vector<HessianType> HessianArrayType;
89 
91  virtual void StartOptimization( bool doOnlyInitialization = false );
92 
94  itkSetMacro(MaximumIterationsWithoutProgress, SizeValueType);
95 
110  itkSetMacro(MaximumNewtonStepSizeInPhysicalUnits, TInternalComputationValueType);
111 
113  itkGetConstReferenceMacro( NewtonStep, DerivativeType );
114 
119  virtual void EstimateNewtonStepOverSubRange( const IndexRangeType& subrange );
120 
121 protected:
122 
125 
129 
134 
139 
142 
144  std::string m_NewtonStepWarning;
145 
147  TInternalComputationValueType m_MaximumNewtonStepSizeInPhysicalUnits;
148 
151 
153  std::vector<bool> m_NewtonStepValidFlags;
154 
156  virtual void EstimateNewtonStep();
157 
162  virtual bool ComputeHessianAndStepWithBFGS(IndexValueType location);
163 
165  virtual void ResetNewtonStep(IndexValueType location);
166 
171  void CombineGradientNewtonStep(void);
172 
182 
187  virtual void AdvanceOneStep(void);
188 
191 
192  virtual void PrintSelf(std::ostream & os, Indent indent) const;
193 
194 private:
195  QuasiNewtonOptimizerv4Template(const Self &); //purposely not implemented
196  void operator=(const Self &); //purposely not implemented
197 
200 };
201 
204 
205 } // end namespace itk
206 
207 #ifndef ITK_MANUAL_INSTANTIATION
208 #include "itkQuasiNewtonOptimizerv4.hxx"
209 #endif
210 
211 #endif
itk::Array2D< TInternalComputationValueType > HessianType
Light weight base class for most itk classes.
virtual void StartOptimization(bool doOnlyInitialization=false)
virtual void ResetNewtonStep(IndexValueType location)
DomainThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_EstimateNewtonStepThreader
signed long IndexValueType
Definition: itkIntTypes.h:150
Superclass::StopConditionType StopConditionType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
GradientDescentOptimizerv4Template< TInternalComputationValueType > Superclass
virtual void EstimateNewtonStepOverSubRange(const IndexRangeType &subrange)
QuasiNewtonOptimizerv4Template< double > QuasiNewtonOptimizerv4
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:44
TInternalComputationValueType m_MaximumNewtonStepSizeInPhysicalUnits
virtual void PrintSelf(std::ostream &os, Indent indent) const
virtual bool ComputeHessianAndStepWithBFGS(IndexValueType location)
TInternalComputationValueType InternalComputationValueType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType
Implement a Quasi-Newton optimizer with BFGS Hessian estimation.