go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxAdaptiveStochasticGradientDescent.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 #ifndef __elxAdaptiveStochasticGradientDescent_h
15 #define __elxAdaptiveStochasticGradientDescent_h
16 
17 #include "elxIncludes.h" // include first to avoid MSVS warning
21 #include "elxProgressCommand.h"
22 #include "itkAdvancedTransform.h"
23 #include "itkMersenneTwisterRandomVariateGenerator.h"
24 
25 namespace elastix
26 {
186 template< class TElastix >
189  public OptimizerBase< TElastix >
190 {
191 public:
192 
197  typedef itk::SmartPointer< Self > Pointer;
198  typedef itk::SmartPointer< const Self > ConstPointer;
199 
201  itkNewMacro( Self );
202 
204  itkTypeMacro( AdaptiveStochasticGradientDescent,
206 
211  elxClassNameMacro( "AdaptiveStochasticGradientDescent" );
212 
215  typedef Superclass1::CostFunctionPointer CostFunctionPointer;
217 
226  typedef itk::SizeValueType SizeValueType;
227 
230 
234  virtual void BeforeRegistration( void );
235 
236  virtual void BeforeEachResolution( void );
237 
238  virtual void AfterEachResolution( void );
239 
240  virtual void AfterEachIteration( void );
241 
242  virtual void AfterRegistration( void );
243 
247  virtual void StartOptimization( void );
248 
253  virtual void ResumeOptimization( void );
254 
256  virtual void MetricErrorResponse( itk::ExceptionObject & err );
257 
267  itkSetMacro( AutomaticParameterEstimation, bool );
268  itkGetConstMacro( AutomaticParameterEstimation, bool );
269 
271  itkSetMacro( MaximumStepLength, double );
272  itkGetConstMacro( MaximumStepLength, double );
273 
275  itkSetMacro( MaximumNumberOfSamplingAttempts, SizeValueType );
276 
278  itkGetConstReferenceMacro( MaximumNumberOfSamplingAttempts, SizeValueType );
279 
280 protected:
281 
283  typedef typename RegistrationType::FixedImageType FixedImageType;
284  typedef typename RegistrationType::MovingImageType MovingImageType;
285 
286  typedef typename FixedImageType::RegionType FixedImageRegionType;
287  typedef typename FixedImageType::IndexType FixedImageIndexType;
288  typedef typename FixedImageType::PointType FixedImagePointType;
289  typedef typename RegistrationType::ITKBaseType itkRegistrationType;
290  typedef typename itkRegistrationType::TransformType TransformType;
291  typedef typename TransformType::JacobianType JacobianType;
294  typedef typename JacobianType::ValueType JacobianValueType;
295  struct SettingsType { double a, A, alpha, fmax, fmin, omega; };
296  typedef typename std::vector< SettingsType > SettingsVectorType;
297 
300 
305  typedef typename
307  typedef
309  typedef typename
313  typedef typename
316 
318  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
319  typedef typename RandomGeneratorType::Pointer RandomGeneratorPointer;
322 
325  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
326  itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
327  typedef typename TransformType::ScalarType CoordinateRepresentationType;
328  typedef itk::AdvancedTransform<
330  itkGetStaticConstMacro( FixedImageDimension ),
331  itkGetStaticConstMacro( MovingImageDimension ) > AdvancedTransformType;
333  typedef typename
335 
338 
341 
346 
349 
352 
354 
356  virtual void CheckForAdvancedTransform( void );
357 
359  virtual void PrintSettingsVector( const SettingsVectorType & settings ) const;
360 
365  virtual void AutomaticParameterEstimation( void );
366 
371  virtual void AutomaticParameterEstimationOriginal( void );
372 
377 
385  virtual void SampleGradients( const ParametersType & mu0,
386  double perturbationSigma, double & gg, double & ee );
387 
392  const ParametersType & parameters, DerivativeType & derivative );
393 
397  virtual void AddRandomPerturbation( ParametersType & parameters, double sigma );
398 
399 private:
400 
401  AdaptiveStochasticGradientDescent( const Self & ); // purposely not implemented
402  void operator=( const Self & ); // purposely not implemented
403 
406 
412 
416 
420 
421 };
422 
423 } // end namespace elastix
424 
425 #ifndef ITK_MANUAL_INSTANTIATION
426 #include "elxAdaptiveStochasticGradientDescent.hxx"
427 #endif
428 
429 #endif // end #ifndef __elxAdaptiveStochasticGradientDescent_h
AdaptiveStochasticGradientDescentOptimizer Superclass1
itk::ComputeDisplacementDistribution< FixedImageType, TransformType > ComputeDisplacementDistributionType
Superclass::RegistrationPointer RegistrationPointer
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::AdvancedTransform< CoordinateRepresentationType, itkGetStaticConstMacro(FixedImageDimension), itkGetStaticConstMacro(MovingImageDimension) > AdvancedTransformType
virtual void AutomaticParameterEstimationUsingDisplacementDistribution(void)
virtual void MetricErrorResponse(itk::ExceptionObject &err)
A gradient descent optimizer with an adaptive gain.
virtual void AddRandomPerturbation(ParametersType &parameters, double sigma)
std::vector< unsigned long > NonZeroJacobianIndicesType
This class is the elastix base class for all Optimizers.
This is a helper class for the automatic parameter estimation of the ASGD optimizer.
ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
itk::ImageRandomSamplerBase< FixedImageType > ImageRandomSamplerBaseType
SmartPointer< Self > Pointer
SmartPointer< Self > Pointer
Superclass::ElastixType ElastixType
Superclass::ConfigurationPointer ConfigurationPointer
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
Superclass::ElastixPointer ElastixPointer
elxClassNameMacro("AdaptiveStochasticGradientDescent")
This class is a base class for any image sampler.
Superclass::ConfigurationType ConfigurationType
SmartPointer< Self > Pointer
virtual void AutomaticParameterEstimationOriginal(void)
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
ImageGridSamplerType::ImageSampleContainerType ImageSampleContainerType
Transform maps points, vectors and covariant vectors from an input space to an output space...
This class implements a gradient descent optimizer with adaptive gain.
SmartPointer< Self > Pointer
itk::Optimizer ITKBaseType
Samples an image by randomly composing a set of physical coordinates.
virtual void GetScaledDerivativeWithExceptionHandling(const ParametersType &parameters, DerivativeType &derivative)
virtual void PrintSettingsVector(const SettingsVectorType &settings) const
itk::SmartPointer< Self > Pointer
This is a helper class for the automatic parameter estimation of the ASGD optimizer.
virtual void SampleGradients(const ParametersType &mu0, double perturbationSigma, double &gg, double &ee)
itk::ImageGridSampler< FixedImageType > ImageGridSamplerType
A specialized Command object for updating the progress of a filter.
This class is a base class for any image sampler that randomly picks samples.
Superclass::RegistrationType RegistrationType
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
itk::ImageSamplerBase< FixedImageType > ImageSamplerBaseType
ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
Samples image voxels on a regular grid.
itk::ComputeJacobianTerms< FixedImageType, TransformType > ComputeJacobianTermsType
itk::ImageRandomCoordinateSampler< FixedImageType > ImageRandomCoordinateSamplerType


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