ITK  4.9.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 ) ITK_OVERRIDE;
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 
133 
137  SizeValueType m_BestIteration;
138 
140  DerivativeType m_NewtonStep;
141 
143  std::string m_NewtonStepWarning;
144 
146  TInternalComputationValueType m_MaximumNewtonStepSizeInPhysicalUnits;
147 
150 
152  std::vector<bool> m_NewtonStepValidFlags;
153 
155  virtual void EstimateNewtonStep();
156 
161  virtual bool ComputeHessianAndStepWithBFGS(IndexValueType location);
162 
164  virtual void ResetNewtonStep(IndexValueType location);
165 
171 
181 
186  virtual void AdvanceOneStep(void) ITK_OVERRIDE;
187 
190 
191  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
192 
193 private:
194  QuasiNewtonOptimizerv4Template(const Self &) ITK_DELETE_FUNCTION;
195  void operator=(const Self &) ITK_DELETE_FUNCTION;
196 
199 };
200 
202 typedef QuasiNewtonOptimizerv4Template<double> QuasiNewtonOptimizerv4;
203 
204 } // end namespace itk
205 
206 #ifndef ITK_MANUAL_INSTANTIATION
207 #include "itkQuasiNewtonOptimizerv4.hxx"
208 #endif
209 
210 #endif
itk::Array2D< TInternalComputationValueType > HessianType
Light weight base class for most itk classes.
Multi-threaded processing on a domain by processing sub-domains per thread.
virtual void ResetNewtonStep(IndexValueType location)
DomainThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_EstimateNewtonStepThreader
signed long IndexValueType
Definition: itkIntTypes.h:150
virtual void AdvanceOneStep(void) override
Superclass::StopConditionType StopConditionType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
GradientDescentOptimizerv4Template< TInternalComputationValueType > Superclass
virtual void EstimateNewtonStepOverSubRange(const IndexRangeType &subrange)
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
virtual void PrintSelf(std::ostream &os, Indent indent) const override
TInternalComputationValueType m_MaximumNewtonStepSizeInPhysicalUnits
virtual bool ComputeHessianAndStepWithBFGS(IndexValueType location)
TInternalComputationValueType InternalComputationValueType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void StartOptimization(bool doOnlyInitialization=false) override
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType
Implement a Quasi-Newton optimizer with BFGS Hessian estimation.