go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxPreconditionedGradientDescent.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
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 __elxPreconditionedGradientDescent_h
19 #define __elxPreconditionedGradientDescent_h
20 
21 #include "elxIncludes.h" // include first to avoid MSVS warning
23 
24 #include "itkImageGridSampler.h"
26 #include "elxProgressCommand.h"
27 #include "itkMersenneTwisterRandomVariateGenerator.h"
28 
29 namespace elastix
30 {
71 template <class TElastix>
74  public OptimizerBase<TElastix>
75 {
76 public:
77 
82  typedef itk::SmartPointer< Self > Pointer;
83  typedef itk::SmartPointer< const Self > ConstPointer;
84 
86  itkNewMacro( Self );
87 
89  itkTypeMacro( PreconditionedGradientDescent,
91 
96  elxClassNameMacro( "PreconditionedGradientDescent" );
97 
100  typedef Superclass1::CostFunctionPointer CostFunctionPointer;
102 
111 
114 
118  //typedef typename Superclass1::EigenSystemType EigenSystemType;
119 
123  virtual void BeforeRegistration( void );
124  virtual void BeforeEachResolution( void );
125  virtual void AfterEachResolution( void );
126  virtual void AfterEachIteration( void );
127  virtual void AfterRegistration( void );
128 
132  virtual void StartOptimization( void );
133 
135  virtual void MetricErrorResponse( itk::ExceptionObject & err );
136 
140  virtual void SetCurrentPositionPublic( const ParametersType & param )
141  {
142  this->Superclass1::SetCurrentPosition( param );
143  }
144 
154  itkSetMacro( AutomaticParameterEstimation, bool );
155  itkGetConstMacro( AutomaticParameterEstimation, bool );
156 
158  itkSetMacro( MaximumNumberOfSamplingAttempts, unsigned long );
159 
161  itkGetConstReferenceMacro( MaximumNumberOfSamplingAttempts, unsigned long );
162 
169  virtual void ResumeOptimization( void );
170 
171 protected:
172 
173  struct SettingsType { double a, A, alpha, fmax, fmin, omega; };
174  typedef typename std::vector<SettingsType> SettingsVectorType;
175 
177  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
178  typedef typename RandomGeneratorType::Pointer RandomGeneratorPointer;
181 
183  typedef typename RegistrationType::FixedImageType FixedImageType;
184  typedef typename RegistrationType::MovingImageType MovingImageType;
188  typedef typename
192  typedef typename
196 
199 
202 
206 
209 
211  virtual void SetSelfHessian( void );
212 
214  virtual void PrintSettingsVector( const SettingsVectorType & settings ) const;
215 
219  virtual void AutomaticParameterEstimation( void );
220 
232  virtual void SampleGradients( const ParametersType & mu0,
233  double & sigma1, double & sigma2 );
234 
239  const ParametersType & parameters, DerivativeType & derivative );
240 
244  virtual void AddRandomPerturbation(
245  const ParametersType & initialParameters,
246  ParametersType & perturbedParameters, double sigma );
247 
248 private:
249 
250  PreconditionedGradientDescent( const Self& ); // purposely not implemented
251  void operator=( const Self& ); // purposely not implemented
252 
257 
260 
263 
264 }; // end class PreconditionedGradientDescent
265 
266 
267 } // end namespace elastix
268 
269 #ifndef ITK_MANUAL_INSTANTIATION
270 #include "elxPreconditionedGradientDescent.hxx"
271 #endif
272 
273 #endif // end #ifndef __elxPreconditionedGradientDescent_h
A class that deals with user given parameters and command line arguments.
This class is the elastix base class for all Optimizers.
Superclass::ConfigurationPointer ConfigurationPointer
itk::Optimizer ITKBaseType
Superclass::ElastixType ElastixType
Superclass::ElastixPointer ElastixPointer
Superclass::RegistrationPointer RegistrationPointer
Superclass::RegistrationType RegistrationType
A gradient descent optimizer with a decaying gain.
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
virtual void AutomaticParameterEstimation(void)
itk::ImageGridSampler< FixedImageType > ImageGridSamplerType
itk::ImageRandomCoordinateSampler< FixedImageType > ImageRandomCoordinateSamplerType
ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
AdaptiveStochasticPreconditionedGradientDescentOptimizer Superclass1
virtual void AddRandomPerturbation(const ParametersType &initialParameters, ParametersType &perturbedParameters, double sigma)
virtual void SetCurrentPositionPublic(const ParametersType &param)
itk::ImageSamplerBase< FixedImageType > ImageSamplerBaseType
itk::ImageRandomSamplerBase< FixedImageType > ImageRandomSamplerBaseType
elxClassNameMacro("PreconditionedGradientDescent")
virtual void MetricErrorResponse(itk::ExceptionObject &err)
Superclass2::ConfigurationPointer ConfigurationPointer
virtual void SampleGradients(const ParametersType &mu0, double &sigma1, double &sigma2)
virtual void PrintSettingsVector(const SettingsVectorType &settings) const
Superclass1::PreconditionValueType PreconditionValueType
ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
virtual void GetScaledDerivativeWithExceptionHandling(const ParametersType &parameters, DerivativeType &derivative)
A specialized Command object for updating the progress of a filter.
itk::SmartPointer< Self > Pointer
Samples image voxels on a regular grid.
SmartPointer< Self > Pointer
Samples an image by randomly composing a set of physical coordinates.
This class is a base class for any image sampler that randomly picks samples.
This class is a base class for any image sampler.
SmartPointer< Self > Pointer
void SetCurrentPosition(const ParametersType &param) override


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.9.1 elastix logo