SuPReMo  0.1.1
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ConjugateGradientOptimiser Class Reference

#include <ConjugateGradientOptimiser.h>

Inheritance diagram for ConjugateGradientOptimiser:
Inheritance graph
[legend]
Collaboration diagram for ConjugateGradientOptimiser:
Collaboration graph
[legend]

Public Member Functions

 ConjugateGradientOptimiser ()
 
 ~ConjugateGradientOptimiser ()
 
void Optimise (PrecisionType *startingPoint)
 
virtual void Initialise ()
 
void SetContinueOptimisation (bool continueOptimisationIn)
 
- Public Member Functions inherited from Optimiser
 Optimiser ()
 
virtual ~Optimiser ()
 
void SetObjectiveFunction (std::shared_ptr< ObjectiveFunction > &objectiveFunctionIn)
 
virtual void Optimise (PrecisionType *startingPoint)=0
 
virtual void Initialise ()=0
 
PrecisionType GetBestObjectiveFunctionValue ()
 
PrecisionType GetInitialObjectiveFunctionValue ()
 
PrecisionTypeGetBestPoint ()
 
void ResetCurrentIterationNumber ()
 
void SetMaxIterations (unsigned int maxIterations)
 
void SetPreviouslyEvaluatedObjectiveFunctionValue (PrecisionType objectiveFunctionValue)
 
void SetOutputIntermediateGradientFolder (const std::string &outputFolderIn, const std::string &outPrefix)
 

Private Member Functions

void CalculateGradientUpdate ()
 
void SaveIntermediateGradientImage ()
 

Private Attributes

PrecisionTypearray1
 The array g in numerical recipes. More...
 
PrecisionTypearray2
 The array h in numerical recipes. More...
 
bool continuationOfOptimisationPossible
 Indicating if array1 and array2 were initialised properly and can be used to continue with the optimisation. More...
 
bool continueOptimisation
 Indicates if the sequence of gradients should be continued. Reg-resp implemented this to be set to true, but it may be beneficial to set this to false and start with a fresh gradient sequence if the motion-compensated image and thus the objective function changed with each switch iteration. More...
 

Additional Inherited Members

- Public Types inherited from Optimiser
typedef float PrecisionType
 
- Protected Member Functions inherited from Optimiser
void MoveCurrentPointAlongGradient (PrecisionType stepSize)
 
void PerformLineSearch (PrecisionType maxLength, PrecisionType smallLength, PrecisionType &startLength)
 
- Protected Attributes inherited from Optimiser
PrecisionType currentObjectiveFunctionValue
 The current objective function value corresponding to the current iteration. More...
 
PrecisionType bestObjectiveFunctionValue
 The best objective function value achieved. More...
 
PrecisionType initialObjectiveFunctionValue
 The objective function value at the starting point of the optimisation. More...
 
unsigned int currentIterationNumber
 Tracker of the current iteration number. More...
 
unsigned int maxNumberOfIterations
 The maximum number of allowed iterations. More...
 
const unsigned int maxNumberOfLineIterations
 The maximum number of iterations used for the line-serach along the gradient. More...
 
PrecisionType maxLineSearchStepSize
 The maximum step size used for the line-search. Has to be initialised in derived class. More...
 
PrecisionType minLineSearchStepSize
 The minimum step size used for the line-search. Has to be initialised in derived class. More...
 
unsigned int numberOfIterationsPerformed
 The total number of iterations performed. More...
 
unsigned int numberOfDOFs
 The number of degrees of freedom. More...
 
std::shared_ptr< ObjectiveFunctionobjectiveFunction
 Shared pointer to the objective function. More...
 
PrecisionTypegradient
 The array xi in numerical recipes. More...
 
PrecisionTypecurrentPoint
 The current point, p in numerical recipes. More...
 
PrecisionTypebestPoint
 The best point achieved, p in numerical recipes. More...
 
PrecisionType preEvaluatedObjectiveFunctionValue
 A pre-calculated objective function value that will be used during the optimisation if usePreEvaluatedEvaluatedObjectiveFunctionValue is set to true. More...
 
bool usePreEvaluatedEvaluatedObjectiveFunctionValue
 Indicator if the first objective function value calculation can be skipped. More...
 
std::string outputIntermediateGradientFolder
 Folder to which the intermediated objective function gradients will be saved. More...
 
std::string outputIntermediateGradientPrefix
 String holding additional information to differentiate the output from different levels. More...
 

Detailed Description

Class implementing the conjugate gradient optimiser according to nifty-reg-resp and Numerical Recipes in C++.

Constructor & Destructor Documentation

◆ ConjugateGradientOptimiser()

ConjugateGradientOptimiser::ConjugateGradientOptimiser ( )

Constructor

◆ ~ConjugateGradientOptimiser()

ConjugateGradientOptimiser::~ConjugateGradientOptimiser ( )

Destructor

Member Function Documentation

◆ CalculateGradientUpdate()

void ConjugateGradientOptimiser::CalculateGradientUpdate ( )
private

Calculate the conjugate gradient update

◆ Initialise()

void ConjugateGradientOptimiser::Initialise ( )
virtual

Initialise the optimiser. Initialises all parameters of the Optimiser base class and conjugate gradient optimiser.

Implements Optimiser.

◆ Optimise()

void ConjugateGradientOptimiser::Optimise ( PrecisionType startingPoint)
virtual

Initiate the optimisation. The iteration numbers as well as the stored objective function values will be reset.

Parameters
startingPointPoint where to start the optimisation from. Can be null-pointer to start form zero.

Implements Optimiser.

◆ SaveIntermediateGradientImage()

void ConjugateGradientOptimiser::SaveIntermediateGradientImage ( )
private

Function that save the current gradient to nifti images if the output file name is not empty.

Note
This will trigger recalculation of the gradient and will affect performance.

◆ SetContinueOptimisation()

void ConjugateGradientOptimiser::SetContinueOptimisation ( bool  continueOptimisationIn)
inline

Set if the gradient sequence should be continued even if the objective function changed. Reg-resp implemented this to be set to true, but it may be beneficial to set this to false and start with a fresh gradient sequence if the motion-compensated image and thus the objective function changed with each switch iteration.

Parameters
continueOptimisationInDefine the continuation of gradient calculation. Set to false for a fresh start.

Member Data Documentation

◆ array1

PrecisionType* ConjugateGradientOptimiser::array1
private

The array g in numerical recipes.

◆ array2

PrecisionType* ConjugateGradientOptimiser::array2
private

The array h in numerical recipes.

◆ continuationOfOptimisationPossible

bool ConjugateGradientOptimiser::continuationOfOptimisationPossible
private

Indicating if array1 and array2 were initialised properly and can be used to continue with the optimisation.

◆ continueOptimisation

bool ConjugateGradientOptimiser::continueOptimisation
private

Indicates if the sequence of gradients should be continued. Reg-resp implemented this to be set to true, but it may be beneficial to set this to false and start with a fresh gradient sequence if the motion-compensated image and thus the objective function changed with each switch iteration.


The documentation for this class was generated from the following files: