go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxPreconditionedStochasticGradientDescent.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 elxPreconditionedStochasticGradientDescent_h
19#define elxPreconditionedStochasticGradientDescent_h
20
21#include "elxIncludes.h" // include first to avoid MSVS warning
23#include "itkComputeDisplacementDistribution.h" // For fast step size estimation
24
25
27#include "elxProgressCommand.h"
29#include "itkMersenneTwisterRandomVariateGenerator.h"
32
33
34namespace elastix
35{
177template <class TElastix>
180 , public OptimizerBase<TElastix>
181{
182public:
184
189 using Pointer = itk::SmartPointer<Self>;
190 using ConstPointer = itk::SmartPointer<const Self>;
191
193 itkNewMacro(Self);
194
196 itkTypeMacro(PreconditionedStochasticGradientDescent, VoxelWiseASGDOptimizer);
197
202 elxClassNameMacro("PreconditionedStochasticGradientDescent");
203
205 using Superclass1::CostFunctionType;
206 using Superclass1::CostFunctionPointer;
208
210 using typename Superclass2::ElastixType;
211 using typename Superclass2::RegistrationType;
213 using SizeValueType = itk::SizeValueType;
214
216 using typename Superclass1::ParametersType;
217
221 void
223
224 void
226
227 void
229
230 void
232
233 void
235
239 void
241
243 void
244 AdvanceOneStep() override;
245
250 void
252
254 void
255 MetricErrorResponse(itk::ExceptionObject & err) override;
256
266 itkSetMacro(AutomaticParameterEstimation, bool);
267 itkGetConstMacro(AutomaticParameterEstimation, bool);
268
270 itkSetMacro(MaximumStepLength, double);
271 itkGetConstReferenceMacro(MaximumStepLength, double);
272
274 itkSetClampMacro(RegularizationKappa, double, 0.0, 1.0);
275 itkGetConstReferenceMacro(RegularizationKappa, double);
276
278 itkSetMacro(MaximumNumberOfSamplingAttempts, SizeValueType);
279 itkGetConstReferenceMacro(MaximumNumberOfSamplingAttempts, SizeValueType);
280
281protected:
284
286 using FixedImageType = typename RegistrationType::FixedImageType;
287 using MovingImageType = typename RegistrationType::MovingImageType;
288
289 using FixedImageRegionType = typename FixedImageType::RegionType;
290 using FixedImageIndexType = typename FixedImageType::IndexType;
291 using FixedImagePointType = typename FixedImageType::PointType;
292 using itkRegistrationType = typename RegistrationType::ITKBaseType;
293 using TransformType = typename itkRegistrationType::TransformType;
294 using JacobianType = typename TransformType::JacobianType;
295 using JacobianValueType = typename JacobianType::ValueType;
297 {
298 double a, A, alpha, fmax, fmin, omega;
299 };
300 using SettingsVectorType = typename std::vector<SettingsType>;
301 using OutputImageType = typename ElastixType::FixedImageType;
302
306
308
321 using ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer;
322
324 using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator;
325 using RandomGeneratorPointer = typename RandomGeneratorType::Pointer;
328
331 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
332 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
333 using CoordinateRepresentationType = typename TransformType::ScalarType;
334
339
343
346
353
356
359
365
367 virtual void
369
374 virtual void
376
384 virtual void
385 SampleGradients(const ParametersType & mu0, double perturbationSigma, double & gg, double & ee);
386
390 virtual void
391 GetScaledDerivativeWithExceptionHandling(const ParametersType & parameters, DerivativeType & derivative);
392
396 virtual void
397 AddRandomPerturbation(ParametersType & parameters, double sigma);
398
399private:
401
405
411
415
419};
420
421} // end namespace elastix
422
423#ifndef ITK_MANUAL_INSTANTIATION
424# include "elxPreconditionedStochasticGradientDescent.hxx"
425#endif
426
427#endif // end #ifndef elxPreconditionedStochasticGradientDescent_h
This class is the elastix base class for all Optimizers.
typename ElastixType::RegistrationBaseType RegistrationType
itk::Optimizer ITKBaseType
typename ITKBaseType::ParametersType ParametersType
virtual void PrintSettingsVector(const SettingsVectorType &settings) const
typename ImageRandomCoordinateSamplerType::Pointer ImageRandomCoordinateSamplerPointer
virtual void GetScaledDerivativeWithExceptionHandling(const ParametersType &parameters, DerivativeType &derivative)
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
typename PreconditionerEstimationType::Pointer PreconditionerEstimationPointer
typename AdvancedBSplineDeformableTransformType::Pointer BSplineTransformBasePointer
virtual void SampleGradients(const ParametersType &mu0, double perturbationSigma, double &gg, double &ee)
typename ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
typename ImageGridSamplerType::ImageSampleContainerType ImageSampleContainerType
ITK_DISALLOW_COPY_AND_MOVE(PreconditionedStochasticGradientDescent)
elxClassNameMacro("PreconditionedStochasticGradientDescent")
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
void MetricErrorResponse(itk::ExceptionObject &err) override
virtual void AddRandomPerturbation(ParametersType &parameters, double sigma)
typename AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
A specialized Command object for updating the progress of a filter.
itk::SmartPointer< Self > Pointer
Base class for deformable transform using a B-spline representation.
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 estimation of a preconditioner for the FPSGD 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.
This class is a base class for any image sampler.
This class implements a gradient descent optimizer with adaptive gain.
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.


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