SuPReMo
0.1.1
|
#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< CorrespondenceModel > | correspondenceModel |
Object that represents the correspondence model. Able to generate a transformation. More... | |
std::shared_ptr< ImageSimilarity > | imageSimilarity |
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< ImageAcquisition > | imageAcquisition |
The object simulating acquisition and calculating the adjoint of the image acquisition procedure. More... | |
Class to compute the objective function. The weigths of the similarity and penatly terms are computed internally.
typedef float ObjectiveFunction::PrecisionType |
typedef std::vector< std::vector<PrecisionType> > ObjectiveFunction::SurrogateSignalType |
ObjectiveFunction::ObjectiveFunction | ( | ) |
Constructor.
ObjectiveFunction::~ObjectiveFunction | ( | ) |
Destructor.
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.
parametersIn | Pointer to the parameters that will be fed into the correspondence model |
gradientOut | Pointer to where the gradient will be written. Calling function needs to handle allocation of gradient. |
normaliseGradient | Set to true if the gradient should be normalised with the maximum transformation length |
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
parametersIn | Pointer to the parameters that will be fed into the correspondence model |
normaliseGradient | Set to true of the gradient should be normalised. Also see GetGradient(). |
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.
unsigned int ObjectiveFunction::GetNumberOfParameters | ( | ) |
Get the number of parameters (degrees of freedom) of the objectve function.
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) \)
parametersIn | Pointer 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. |
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.
correspondenceModelIn | Pointer to the correspondence model used |
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.
dynamicImagesIn | Vector holding the pointer to the dynamic images. Must be of same size as surrogate signals ObjectiveFunction::SetSurrogateSignals. |
dynamicDataTypeIn | Defines the type of the dynamic data |
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.
imageAcquisitionIn | Shared pointer to the image acquisition object. |
void ObjectiveFunction::SetReferenceStateImage | ( | nifti_image * | refStateImgIn | ) |
Set the current reference state image
refStateImgIn | Pointer to the nifti_image structure holding the reference state image |
void ObjectiveFunction::SetSimilarityMeasure | ( | const std::shared_ptr< ImageSimilarity > & | imageSimilarityIn | ) |
Set the object that measures the similarity between images.
imageSimilarityIn | Image similarity object. |
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).
|
private |
Object that represents the correspondence model. Able to generate a transformation.
|
private |
Vector holding all pointers to the dynamic images.
|
private |
The object simulating acquisition and calculating the adjoint of the image acquisition procedure.
|
private |
Object that measures the similarity between two images.
|
private |
Nifti image structure with all.
|
private |
Similarity weight.
\[ 1-\lambda \]
|
private |
All surrogate signals.