18#ifndef elxAdaptiveStochasticLBFGS_h
19#define elxAdaptiveStochasticLBFGS_h
26#include "itkMersenneTwisterRandomVariateGenerator.h"
29#include "itkMultiThreaderBase.h"
102template <
class TElastix>
130 using Superclass1::CostFunctionType;
131 using Superclass1::CostFunctionPointer;
145 using typename Superclass1::ParametersType;
206 itkSetMacro(AutomaticParameterEstimation,
bool);
207 itkGetConstMacro(AutomaticParameterEstimation,
bool);
210 itkSetMacro(AutomaticLBFGSStepsizeEstimation,
bool);
211 itkGetConstMacro(AutomaticLBFGSStepsizeEstimation,
bool);
214 itkSetMacro(MaximumStepLength,
double);
215 itkGetConstMacro(MaximumStepLength,
double);
230 this->m_Threader->SetNumberOfWorkUnits(numberOfThreads);
285 using SType = std::vector<ParametersType>;
286 using YType = std::vector<DerivativeType>;
403 static itk::ITK_THREAD_RETURN_TYPE
440#ifndef ITK_MANUAL_INSTANTIATION
441# include "elxAdaptiveStochasticLBFGS.hxx"
A gradient descent optimizer with an adaptive gain.
typename RegistrationType::ITKBaseType itkRegistrationType
SizeValueType m_OutsideIterations
void StartOptimization() override
typename TransformType::JacobianType JacobianType
typename TransformType::ScalarType CoordinateRepresentationType
void AdvanceOneStep() override
virtual void StoreCurrentPoint(const ParametersType &step, const DerivativeType &grad_dif)
virtual void ComputeDiagonalMatrix(DiagonalMatrixType &diag_H0)
typename ImageRandomSamplerType::Pointer ImageRandomSamplerPointer
void SetNumberOfWorkUnits(ThreadIdType numberOfThreads)
ITK_DISALLOW_COPY_AND_MOVE(AdaptiveStochasticLBFGS)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
typename Superclass2::ITKBaseType ITKBaseType
typename JacobianType::ValueType JacobianValueType
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
AdaptiveStochasticLBFGS()
virtual void AutomaticParameterEstimation()
SettingsVectorType m_SettingsVector
void AfterEachIteration() override
typename ImageSampleContainerType::Pointer ImageSampleContainerPointer
itk::Array< double > RhoType
void ThreadedAdvanceOneStep(ThreadIdType threadId, ParametersType &newPosition)
itk::SmartPointer< Self > Pointer
typename ImageGridSamplerType::ImageSampleContainerType ImageSampleContainerType
static itk::ITK_THREAD_RETURN_TYPE AdvanceOneStepThreaderCallback(void *arg)
virtual void ComputeSearchDirection(const DerivativeType &gradient, DerivativeType &searchDir)
bool m_AutomaticLBFGSStepsizeEstimation
void ResumeOptimization() override
bool m_OriginalButSigmoidToDefault
virtual void AutomaticLBFGSStepsizeEstimation()
itk::SizeValueType SizeValueType
elxClassNameMacro("AdaptiveStochasticLBFGS")
double m_SigmoidScaleFactor
std::vector< ParametersType > SType
void StopOptimization() override
bool m_UseAdaptiveLBFGSStepSizes
RandomGeneratorType::Pointer m_RandomGenerator
SizeValueType m_MaximumNumberOfSamplingAttempts
JacobianType TransformJacobianType
virtual void AddRandomPerturbation(ParametersType ¶meters, double sigma)
SizeValueType m_PreviousErrorAtIteration
itk::Array< double > DiagonalMatrixType
typename FixedImageType::PointType FixedImagePointType
bool m_UseNoiseCompensation
typename itkRegistrationType::TransformType TransformType
typename ImageGridSamplerType::Pointer ImageGridSamplerPointer
DerivativeType m_PreviousCurvatureGradient
typename FixedImageType::RegionType FixedImageRegionType
virtual void GetScaledDerivativeWithExceptionHandling(const ParametersType ¶meters, DerivativeType &derivative)
void BeforeEachResolution() override
SizeValueType m_NumberOfSpatialSamples
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
virtual void AutomaticParameterEstimationOriginal()
typename ImageSamplerBaseType::ImageSampleType ImageSampleType
typename ImageRadomSampleContainerType::Pointer ImageRadomSampleContainerPointer
typename RegistrationType::MovingImageType MovingImageType
virtual void SampleGradients(const ParametersType &mu0, double perturbationSigma, double &gg, double &ee)
bool m_AutomaticParameterEstimationDone
typename ImageSamplerBaseType::Pointer ImageSamplerBasePointer
typename ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
void AfterEachResolution() override
typename std::vector< SettingsType > SettingsVectorType
SizeValueType m_NumberOfBandStructureSamples
virtual void AutomaticParameterEstimationUsingDisplacementDistribution()
typename ImageRandomSamplerType::ImageSampleContainerType ImageRadomSampleContainerType
RhoType m_HessianFillValue
std::vector< DerivativeType > YType
itk::SmartPointer< const Self > ConstPointer
typename RegistrationType::FixedImageType FixedImageType
bool m_AutomaticParameterEstimation
typename ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
virtual void LBFGSUpdate()
SizeValueType m_CurrentNumberOfSamplingAttempts
void BeforeRegistration() override
AdvancedTransformType::Pointer m_AdvancedTransform
SizeValueType m_NumberOfJacobianMeasurements
double m_MaximumStepLength
SizeValueType m_NumberOfGradientMeasurements
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
void AfterRegistration() override
typename FixedImageType::IndexType FixedImageIndexType
SizeValueType m_MaxBandCovSize
~AdaptiveStochasticLBFGS() override=default
SizeValueType m_NumberOfSamplesForExactGradient
void MetricErrorResponse(itk::ExceptionObject &err) override
SizeValueType m_NumberOfInnerLoopSamples
This class is the elastix base class for all Optimizers.
typename ElastixType::RegistrationBaseType RegistrationType
itk::Optimizer ITKBaseType
typename std::vector< SettingsType > SettingsVectorType
typename ITKBaseType::ParametersType ParametersType
This is a helper class for the automatic parameter estimation of the ASGD optimizer.
This is a helper class for the automatic parameter estimation of the ASGD optimizer.
Samples image voxels on a regular grid.
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.
Samples randomly some voxels of an image.
A class that defines an image sample, which is the coordinates of a point and its value.
This class is a base class for any image sampler.
A base class for LineSearch optimizers.
ITK version of the MoreThuente line search algorithm.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
ParametersType * t_NewPosition