go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkGradientDescentOptimizer2.h
Go to the documentation of this file.
1 /*======================================================================
2 
3  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __itkGradientDescentOptimizer2_h
16 #define __itkGradientDescentOptimizer2_h
17 
19 #include "itkMultiThreader.h"
20 
21 namespace itk
22 {
23 
52 {
53 public:
54 
58  typedef SmartPointer< Self > Pointer;
59  typedef SmartPointer< const Self > ConstPointer;
60 
62  itkNewMacro( Self );
63 
66 
75 
79  typedef enum {
84 
86  virtual void AdvanceOneStep( void );
87 
89  virtual void StartOptimization( void );
90 
93  virtual void ResumeOptimization( void );
94 
96  virtual void MetricErrorResponse( ExceptionObject & err );
97 
100  virtual void StopOptimization( void );
101 
103  itkSetMacro( LearningRate, double );
104 
106  itkGetConstReferenceMacro( LearningRate, double );
107 
109  itkSetMacro( NumberOfIterations, unsigned long );
110 
112  itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
113 
115  itkGetConstMacro( CurrentIteration, unsigned int );
116 
118  itkGetConstReferenceMacro( Value, double );
119 
121  itkGetConstReferenceMacro( StopCondition, StopConditionType );
122 
124  itkGetConstReferenceMacro( Gradient, DerivativeType );
125 
127  void SetNumberOfThreads( ThreadIdType numberOfThreads )
128  {
129  this->m_Threader->SetNumberOfThreads( numberOfThreads );
130  }
131 
132 
133  //itkGetConstReferenceMacro( NumberOfThreads, ThreadIdType );
134  itkSetMacro( UseMultiThread, bool );
135 
136  itkSetMacro( UseOpenMP, bool );
137  itkSetMacro( UseEigen, bool );
138 
139 protected:
140 
143  void PrintSelf( std::ostream & os, Indent indent ) const;
144 
146  typedef itk::MultiThreader ThreaderType;
147  typedef ThreaderType::ThreadInfoStruct ThreadInfoType;
148 
149  // made protected so subclass can access
150  double m_Value;
154 
155  ThreaderType::Pointer m_Threader;
156 
157  bool m_Stop;
158  unsigned long m_NumberOfIterations;
159  unsigned long m_CurrentIteration;
160 
161 private:
162 
163  GradientDescentOptimizer2( const Self & ); // purposely not implemented
164  void operator=( const Self & ); // purposely not implemented
165 
166  // multi-threaded AdvanceOneStep:
169  {
172  };
173 
176 
178  static ITK_THREAD_RETURN_TYPE AdvanceOneStepThreaderCallback( void * arg );
179 
181  inline void ThreadedAdvanceOneStep( ThreadIdType threadId, ParametersType & newPosition );
182 
183 };
184 
185 } // end namespace itk
186 
187 #endif
Implement a gradient descent optimizer.
void operator=(const Self &)
virtual void StartOptimization(void)
ScaledSingleValuedNonLinearOptimizer Superclass
Superclass::DerivativeType DerivativeType
Superclass::ScaledCostFunctionType ScaledCostFunctionType
virtual void StopOptimization(void)
void PrintSelf(std::ostream &os, Indent indent) const
void SetNumberOfThreads(ThreadIdType numberOfThreads)
virtual void AdvanceOneStep(void)
virtual void MetricErrorResponse(ExceptionObject &err)
void ThreadedAdvanceOneStep(ThreadIdType threadId, ParametersType &newPosition)
Superclass::ParametersType ParametersType
Superclass::CostFunctionType CostFunctionType
ThreaderType::ThreadInfoStruct ThreadInfoType
virtual void ResumeOptimization(void)
Superclass::ScaledCostFunctionPointer ScaledCostFunctionPointer
static ITK_THREAD_RETURN_TYPE AdvanceOneStepThreaderCallback(void *arg)


Generated on 11-03-2014 for elastix by doxygen 1.8.6 elastix logo