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
29namespace elastix
30{
71template <class TElastix>
72class ITK_TEMPLATE_EXPORT PreconditionedGradientDescent
74 , public OptimizerBase<TElastix>
75{
76public:
78
83 using Pointer = itk::SmartPointer<Self>;
84 using ConstPointer = itk::SmartPointer<const Self>;
85
87 itkNewMacro(Self);
88
91
96 elxClassNameMacro("PreconditionedGradientDescent");
97
99 using Superclass1::CostFunctionType;
100 using Superclass1::CostFunctionPointer;
102
104 using typename Superclass2::ElastixType;
105 using typename Superclass2::RegistrationType;
107
109 using typename Superclass1::ParametersType;
110
113 using typename Superclass1::PreconditionType;
114 // using typename Superclass1::EigenSystemType;
115
119 virtual void
121 virtual void
123 virtual void
125 virtual void
127 virtual void
129
133 virtual void
135
137 virtual void
138 MetricErrorResponse(itk::ExceptionObject & err);
139
143 virtual void
145 {
146 this->Superclass1::SetCurrentPosition(param);
147 }
148
158 itkSetMacro(AutomaticParameterEstimation, bool);
159 itkGetConstMacro(AutomaticParameterEstimation, bool);
160
162 itkSetMacro(MaximumNumberOfSamplingAttempts, unsigned long);
163
165 itkGetConstReferenceMacro(MaximumNumberOfSamplingAttempts, unsigned long);
166
173 virtual void
175
176protected:
178 {
179 double a, A, alpha, fmax, fmin, omega;
180 };
181 using SettingsVectorType = typename std::vector<SettingsType>;
182
184 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
185 using RandomGeneratorPointer = typename RandomGeneratorType::Pointer;
188
190 using FixedImageType = typename RegistrationType::FixedImageType;
191 using MovingImageType = typename RegistrationType::MovingImageType;
200
203
206
210
213
215 virtual void
217
219 virtual void
221
225 virtual void
227
239 virtual void
240 SampleGradients(const ParametersType & mu0, double & sigma1, double & sigma2);
241
245 virtual void
246 GetScaledDerivativeWithExceptionHandling(const ParametersType & parameters, DerivativeType & derivative);
247
251 virtual void
252 AddRandomPerturbation(const ParametersType & initialParameters, ParametersType & perturbedParameters, double sigma);
253
254private:
256
261
264
267
268}; // end class PreconditionedGradientDescent
269
270
271} // end namespace elastix
272
273#ifndef ITK_MANUAL_INSTANTIATION
274# include "elxPreconditionedGradientDescent.hxx"
275#endif
276
277#endif // end #ifndef elxPreconditionedGradientDescent_h
This class is the elastix base class for all Optimizers.
typename ElastixType::RegistrationBaseType RegistrationType
itk::Optimizer ITKBaseType
typename ITKBaseType::ParametersType ParametersType
A gradient descent optimizer with a decaying gain.
typename ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
typename ImageGridSamplerType::Pointer ImageGridSamplerPointer
typename ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
typename ProgressCommand::Pointer ProgressCommandPointer
typename RandomGeneratorType::Pointer RandomGeneratorPointer
typename std::vector< SettingsType > SettingsVectorType
virtual void AddRandomPerturbation(const ParametersType &initialParameters, ParametersType &perturbedParameters, double sigma)
virtual void SetCurrentPositionPublic(const ParametersType &param)
typename ImageSamplerBaseType::Pointer ImageSamplerBasePointer
typename RegistrationType::MovingImageType MovingImageType
typename RegistrationType::FixedImageType FixedImageType
elxClassNameMacro("PreconditionedGradientDescent")
virtual void MetricErrorResponse(itk::ExceptionObject &err)
ITK_DISALLOW_COPY_AND_MOVE(PreconditionedGradientDescent)
virtual void SampleGradients(const ParametersType &mu0, double &sigma1, double &sigma2)
virtual void PrintSettingsVector(const SettingsVectorType &settings) const
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
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.
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.


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo