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

#include <ObjectiveFunction.h>

Public Types

typedef float PrecisionType
 
typedef std::vector< std::vector< PrecisionType > > SurrogateSignalType
 

Public Member Functions

 ObjectiveFunction ()
 
 ~ObjectiveFunction ()
 
PrecisionType GetValue (const PrecisionType *parametersIn)
 
void GetGradient (const PrecisionType *parametersIn, PrecisionType *gradientOut, bool normaliseGradient=false)
 
std::vector< nifti_image * > GetGradientAsImage (const PrecisionType *parametersIn, bool normaliseGradient=false)
 
unsigned int GetNumberOfParameters ()
 
PrecisionType GetMaxStepSize ()
 
void SetCorrespondenceModel (const std::shared_ptr< CorrespondenceModel > &correspondenceModelIn)
 
void SetSimilarityMeasure (const std::shared_ptr< ImageSimilarity > &imageSimilarityIn)
 
void SetSurrogateSignals (const SurrogateSignalType &surrSignalsIn)
 
void SetReferenceStateImage (nifti_image *refStateImgIn)
 
void SetDynamicImages (const std::vector< nifti_image * > &dynamicImagesIn)
 
void SetImageAcquisition (const std::shared_ptr< ImageAcquisition > &imageAcquisitionIn)
 

Private Attributes

std::shared_ptr< CorrespondenceModelcorrespondenceModel
 Object that represents the correspondence model. Able to generate a transformation. More...
 
std::shared_ptr< ImageSimilarityimageSimilarity
 Object that measures the similarity between two images. More...
 
SurrogateSignalType surrogateSignals
 All surrogate signals. More...
 
nifti_image * referenceStateImage
 Nifti image structure with all. More...
 
std::vector< nifti_image * > dynamicImages
 Vector holding all pointers to the dynamic images. More...
 
PrecisionType similarityWeight
 Similarity weight. More...
 
std::shared_ptr< ImageAcquisitionimageAcquisition
 The object simulating acquisition and calculating the adjoint of the image acquisition procedure. More...
 

Detailed Description

Class to compute the objective function. The weigths of the similarity and penatly terms are computed internally.

Member Typedef Documentation

◆ PrecisionType

◆ SurrogateSignalType

typedef std::vector< std::vector<PrecisionType> > ObjectiveFunction::SurrogateSignalType

Constructor & Destructor Documentation

◆ ObjectiveFunction()

ObjectiveFunction::ObjectiveFunction ( )

Constructor.

◆ ~ObjectiveFunction()

ObjectiveFunction::~ObjectiveFunction ( )

Destructor.

Member Function Documentation

◆ GetGradient()

void ObjectiveFunction::GetGradient ( const PrecisionType parametersIn,
PrecisionType gradientOut,
bool  normaliseGradient = false 
)

Get the gradient of the objective function for a specific set of parameters This function copies the gradienbt of the objective function to an externally allocated memory location.

Parameters
parametersInPointer to the parameters that will be fed into the correspondence model
gradientOutPointer to where the gradient will be written. Calling function needs to handle allocation of gradient.
normaliseGradientSet to true if the gradient should be normalised with the maximum transformation length

◆ GetGradientAsImage()

std::vector< nifti_image * > ObjectiveFunction::GetGradientAsImage ( const PrecisionType parametersIn,
bool  normaliseGradient = false 
)

Calculate the gradient for the input parameters and return an image with the gradient

Parameters
parametersInPointer to the parameters that will be fed into the correspondence model
normaliseGradientSet to true of the gradient should be normalised. Also see GetGradient().

◆ GetMaxStepSize()

ObjectiveFunction::PrecisionType ObjectiveFunction::GetMaxStepSize ( )

Get the maximum step size for the line-optimisation. Calcualtes the maximum step size \( l_\mathrm{max} \) from the voxel size of the reference-state image ( \( \{d_x, d_y, d_z\} \)) and the surrogate signal values \( s_i \).

\[ l_\mathrm{max} = \frac{\max(\{d_x, d_y, d_z\})}{\max( \| s_i \| ) } \]

Obsiously both, surrogate signal and reference-state image have to be set before calling this function.

◆ GetNumberOfParameters()

unsigned int ObjectiveFunction::GetNumberOfParameters ( )

Get the number of parameters (degrees of freedom) of the objectve function.

◆ GetValue()

ObjectiveFunction::PrecisionType ObjectiveFunction::GetValue ( const PrecisionType parametersIn)

Get the value of the objective function for a specific set of parameters Calculates \( \mathcal{C}_\text{total} = \sum_{t=1}^{N_i} \lambda \mathcal{S}( \mathbf{P}_t, A_t(\mathbf{T}(\mathbf{I}, \mathbf{M}_t))) + (1-\lambda)\mathcal{R}(\mathbf{M}_t) \)

Parameters
parametersInPointer to the parameters that will be fed into the correspondence model, or point \(\mathbf{R}\) in high-dimensional space for which the objective function-value will be calculated.

◆ SetCorrespondenceModel()

void ObjectiveFunction::SetCorrespondenceModel ( const std::shared_ptr< CorrespondenceModel > &  correspondenceModelIn)

Set the correspondence model. When the correspondence model is set, the transformation is defined and the similarity and penalty term weights are updated.

Parameters
correspondenceModelInPointer to the correspondence model used

◆ SetDynamicImages()

void ObjectiveFunction::SetDynamicImages ( const std::vector< nifti_image * > &  dynamicImagesIn)

Set the dynamic images. Only set the resolution that is to be computed for each level.

Parameters
dynamicImagesInVector holding the pointer to the dynamic images. Must be of same size as surrogate signals ObjectiveFunction::SetSurrogateSignals.
dynamicDataTypeInDefines the type of the dynamic data

◆ SetImageAcquisition()

void ObjectiveFunction::SetImageAcquisition ( const std::shared_ptr< ImageAcquisition > &  imageAcquisitionIn)

Set the image acquisition object. Has to implement functionality to simulate the acquisition process and to calculate the adjoint of that process.

Parameters
imageAcquisitionInShared pointer to the image acquisition object.

◆ SetReferenceStateImage()

void ObjectiveFunction::SetReferenceStateImage ( nifti_image *  refStateImgIn)

Set the current reference state image

Parameters
refStateImgInPointer to the nifti_image structure holding the reference state image

◆ SetSimilarityMeasure()

void ObjectiveFunction::SetSimilarityMeasure ( const std::shared_ptr< ImageSimilarity > &  imageSimilarityIn)

Set the object that measures the similarity between images.

Parameters
imageSimilarityInImage similarity object.

◆ SetSurrogateSignals()

void ObjectiveFunction::SetSurrogateSignals ( const SurrogateSignalType surrSignalsIn)

Set the surrogate signal To measure the objective function, all the surrogate values need to be known (and of correct size).

Member Data Documentation

◆ correspondenceModel

std::shared_ptr<CorrespondenceModel> ObjectiveFunction::correspondenceModel
private

Object that represents the correspondence model. Able to generate a transformation.

◆ dynamicImages

std::vector<nifti_image*> ObjectiveFunction::dynamicImages
private

Vector holding all pointers to the dynamic images.

◆ imageAcquisition

std::shared_ptr<ImageAcquisition> ObjectiveFunction::imageAcquisition
private

The object simulating acquisition and calculating the adjoint of the image acquisition procedure.

◆ imageSimilarity

std::shared_ptr<ImageSimilarity> ObjectiveFunction::imageSimilarity
private

Object that measures the similarity between two images.

◆ referenceStateImage

nifti_image* ObjectiveFunction::referenceStateImage
private

Nifti image structure with all.

◆ similarityWeight

PrecisionType ObjectiveFunction::similarityWeight
private

Similarity weight.

\[ 1-\lambda \]

◆ surrogateSignals

SurrogateSignalType ObjectiveFunction::surrogateSignals
private

All surrogate signals.


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