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 * 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 __elxAdaptiveStochasticGradientDescent_h
19#define __elxAdaptiveStochasticGradientDescent_h
20
21#include "elxIncludes.h" // include first to avoid MSVS warning
23
24#include "itkComputeJacobianTerms.h" // For ASGD step size
25#include "itkComputeDisplacementDistribution.h" // For FASGD step size
26#include "elxProgressCommand.h"
28#include "itkMersenneTwisterRandomVariateGenerator.h"
29
30
31namespace elastix
32{
192template< class TElastix >
195 public OptimizerBase< TElastix >
196{
197public:
198
203 typedef itk::SmartPointer< Self > Pointer;
204 typedef itk::SmartPointer< const Self > ConstPointer;
205
207 itkNewMacro( Self );
208
212
217 elxClassNameMacro( "AdaptiveStochasticGradientDescent" );
218
221 typedef Superclass1::CostFunctionPointer CostFunctionPointer;
223
232 typedef itk::SizeValueType SizeValueType;
233
236
240 void BeforeRegistration( void ) override;
241
242 void BeforeEachResolution( void ) override;
243
244 void AfterEachResolution( void ) override;
245
246 void AfterEachIteration( void ) override;
247
248 void AfterRegistration( void ) override;
249
253 void StartOptimization( void ) override;
254
259 void ResumeOptimization( void ) override;
260
262 void MetricErrorResponse( itk::ExceptionObject & err ) override;
263
273 itkSetMacro( AutomaticParameterEstimation, bool );
274 itkGetConstMacro( AutomaticParameterEstimation, bool );
275
277 itkSetMacro( MaximumStepLength, double );
278 itkGetConstMacro( MaximumStepLength, double );
279
281 itkSetMacro( MaximumNumberOfSamplingAttempts, SizeValueType );
282
284 itkGetConstReferenceMacro( MaximumNumberOfSamplingAttempts, SizeValueType );
285
286protected:
287
289 typedef typename RegistrationType::FixedImageType FixedImageType;
290 typedef typename RegistrationType::MovingImageType MovingImageType;
291
292 typedef typename FixedImageType::RegionType FixedImageRegionType;
293 typedef typename FixedImageType::IndexType FixedImageIndexType;
294 typedef typename FixedImageType::PointType FixedImagePointType;
295 typedef typename RegistrationType::ITKBaseType itkRegistrationType;
296 typedef typename itkRegistrationType::TransformType TransformType;
297 typedef typename TransformType::JacobianType JacobianType;
300 typedef typename JacobianType::ValueType JacobianValueType;
301 struct SettingsType { double a, A, alpha, fmax, fmin, omega; };
302 typedef typename std::vector< SettingsType > SettingsVectorType;
303
306
311 typedef typename
313 typedef
315 typedef typename
319 typedef typename
322
324 typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
325 typedef typename RandomGeneratorType::Pointer RandomGeneratorPointer;
328
331 itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
332 itkStaticConstMacro( MovingImageDimension, unsigned int, MovingImageType::ImageDimension );
333 typedef typename TransformType::ScalarType CoordinateRepresentationType;
336 itkGetStaticConstMacro( FixedImageDimension ),
337 itkGetStaticConstMacro( MovingImageDimension ) > AdvancedTransformType;
339 typedef typename
341
344
347
352
355
358
360
362 virtual void CheckForAdvancedTransform( void );
363
365 virtual void PrintSettingsVector( const SettingsVectorType & settings ) const;
366
371 virtual void AutomaticParameterEstimation( void );
372
378
383
391 virtual void SampleGradients( const ParametersType & mu0,
392 double perturbationSigma, double & gg, double & ee );
393
398 const ParametersType & parameters, DerivativeType & derivative );
399
403 virtual void AddRandomPerturbation( ParametersType & parameters, double sigma );
404
405private:
406
407 AdaptiveStochasticGradientDescent( const Self & ); // purposely not implemented
408 void operator=( const Self & ); // purposely not implemented
409
413
419
423
427
428};
429
430} // end namespace elastix
431
432#ifndef ITK_MANUAL_INSTANTIATION
433#include "elxAdaptiveStochasticGradientDescent.hxx"
434#endif
435
436#endif // end #ifndef __elxAdaptiveStochasticGradientDescent_h
A gradient descent optimizer with an adaptive gain.
itk::ImageGridSampler< FixedImageType > ImageGridSamplerType
virtual void PrintSettingsVector(const SettingsVectorType &settings) const
ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
itk::ComputeJacobianTerms< FixedImageType, TransformType > ComputeJacobianTermsType
ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
virtual void SampleGradients(const ParametersType &mu0, double perturbationSigma, double &gg, double &ee)
itk::ImageSamplerBase< FixedImageType > ImageSamplerBaseType
itk::AdvancedTransform< CoordinateRepresentationType, itkGetStaticConstMacro(FixedImageDimension), itkGetStaticConstMacro(MovingImageDimension) > AdvancedTransformType
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
virtual void AutomaticParameterEstimationUsingDisplacementDistribution(void)
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::ComputeDisplacementDistribution< FixedImageType, TransformType > ComputeDisplacementDistributionType
itk::ImageRandomCoordinateSampler< FixedImageType > ImageRandomCoordinateSamplerType
elxClassNameMacro("AdaptiveStochasticGradientDescent")
virtual void AddRandomPerturbation(ParametersType &parameters, double sigma)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itk::ImageRandomSamplerBase< FixedImageType > ImageRandomSamplerBaseType
void MetricErrorResponse(itk::ExceptionObject &err) override
virtual void GetScaledDerivativeWithExceptionHandling(const ParametersType &parameters, DerivativeType &derivative)
ImageGridSamplerType::ImageSampleContainerType ImageSampleContainerType
AdaptiveStochasticGradientDescentOptimizer Superclass1
virtual void AutomaticParameterEstimationOriginal(void)
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 specialized Command object for updating the progress of a filter.
itk::SmartPointer< Self > Pointer
This class implements a gradient descent optimizer with adaptive gain.
Transform maps points, vectors and covariant vectors from an input space to an output space.
std::vector< unsigned long > NonZeroJacobianIndicesType
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.
This class is a base class for any image sampler.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo