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

#include <BSplineTransformation.h>

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

Public Types

typedef Transformation::PrecisionType PrecisionType
 
- Public Types inherited from Transformation
typedef float PrecisionType
 

Public Member Functions

 BSplineTransformation (nifti_image *referenceImageIn, unsigned int numberOfLevelsToPerform, float *finalControlPointGridSpacing)
 
 BSplineTransformation (const BSplineTransformation &transformToCopy)
 
 ~BSplineTransformation ()
 
virtual void InitialiseLevel (unsigned int level)
 
void SetParameters (PrecisionType *parametersIn, bool parametersAreDisplacements)
 
virtual nifti_image * GetDeformationVectorField (nifti_image *targetImageIn)
 
virtual BSplineTransformation::PrecisionTypeGetDVFGradientWRTTransformationParameters (nifti_image *denseDVFIn)
 
virtual BSplineTransformation::PrecisionTypeGetConstraintGradientWRTTransformationParameters ()
 
double GetConstraintValue ()
 
virtual PrecisionTypeGetCopyOfParameters ()
 
void SetLinearEnergyWeight (double linearEnergyWeightIn)
 
void SetBendingEnergyWeight (double bendingEnergyWeightIn)
 
std::shared_ptr< TransformationDeepCopy ()
 
void DisplayTransformationParameters ()
 
virtual PrecisionType GetSumOfPenaltyWeights ()
 
virtual PrecisionType GetMaxTransformationParameterLength (PrecisionType *parametersIn)
 
std::vector< nifti_image * > GetTransformationAsImage ()
 
- Public Member Functions inherited from Transformation
virtual ~Transformation ()
 
virtual void InitialiseLevel (unsigned int level)=0
 
virtual PrecisionTypeGetCopyOfParameters ()=0
 
virtual unsigned int GetNumberOfParameters ()
 
virtual void SetParameters (PrecisionType *paramsIn, bool parametersAreDisplacements)=0
 
virtual nifti_image * GetDeformationVectorField (nifti_image *targetImageIn)=0
 
virtual PrecisionTypeGetDVFGradientWRTTransformationParameters (nifti_image *denseDVFIn)=0
 
virtual PrecisionTypeGetConstraintGradientWRTTransformationParameters ()=0
 
virtual double GetConstraintValue ()=0
 
void TransformImage (nifti_image *sourceImage, nifti_image *warpedImage)
 
void TransformImageAdjoint (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
virtual std::shared_ptr< TransformationDeepCopy ()=0
 
virtual void DisplayTransformationParameters ()=0
 
virtual PrecisionType GetSumOfPenaltyWeights ()=0
 
virtual void GetImageGradientWRTDVF (nifti_image *sourceImage, nifti_image *outWarpedGradientImage)
 
void ReorientateVectorImage (nifti_image *vectorFieldToReorientate, mat44 reorientationMatrix)
 
virtual PrecisionType GetMaxTransformationParameterLength (PrecisionType *parametersIn)=0
 
virtual std::vector< nifti_image * > GetTransformationAsImage ()=0
 
PrecisionType GetPaddingValue ()
 

Protected Member Functions

void CPGToDVF2D (nifti_image *denseVectorFieldImage)
 
void CPGToDVF3D (nifti_image *denseVectorFieldImage)
 
void DVFToCPG2D (nifti_image *controlPointGridImage, nifti_image *denseVectorFieldImage, bool normaliseKernel)
 
void DVFToCPG3D (nifti_image *controlPointGridImage, nifti_image *denseVectorFieldImage, bool normaliseKernel)
 
- Protected Member Functions inherited from Transformation
bool CheckDVFImageUpdateRequired (nifti_image *targetImageIn)
 
bool CheckImageGeometryEquality (nifti_image *img1, nifti_image *img2)
 
virtual void ClearDeformationVectorFieldImage ()
 
void CubicSplineTransformImage3D (nifti_image *sourceImage, nifti_image *warpedImage)
 
void CubicSplineTransformImage2D (nifti_image *sourceImage, nifti_image *warpedImage)
 
void NearestNeighbourTransformImage3D (nifti_image *sourceImage, nifti_image *warpedImage)
 
void NearestNeighbourTransformImage2D (nifti_image *sourceImage, nifti_image *warpedImage)
 
void TrilinearTransformImage (nifti_image *sourceImage, nifti_image *warpedImage)
 
void BilinearTransformImage (nifti_image *sourceImage, nifti_image *warpedImage)
 
void CubicSplineTransformImageAdjoint3D (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void CubicSplineTransformImageAdjoint2D (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void NearestNeighbourTransformImageAdjoint3D (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void NearestNeighbourTransformImageAdjoint2D (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void TrilinearTransformImageAdjoint (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void BilinearTransformImageAdjoint (nifti_image *sourceImage, nifti_image *sourceWeightsImage, nifti_image *warpedImage, nifti_image *warpedWeightsImage)
 
void TrilinearImageGradient (nifti_image *sourceImage, nifti_image *resultGradientImage)
 
void BilinearImageGradient (nifti_image *sourceImage, nifti_image *resultGradientImage)
 
void CubicSplineImageGradient3D (nifti_image *sourceImage, nifti_image *resultGradientImage)
 
void CubicSplineImageGradient2D (nifti_image *sourceImage, nifti_image *resultGradientImage)
 

Protected Attributes

nifti_image * controlPointGridImage
 ‍** Function to reorientate vectors in 5D nifti image. More...
 
double bendingEnergyWeight
 The bending-energy weight. More...
 
double linearEnergyWeight
 The linear energy weight. More...
 
- Protected Attributes inherited from Transformation
bool dvfImageUpdateRequired
 Indicates if the DVF requires re-calculation when it is required. More...
 
unsigned int numberOfParameters
 The total number of parameters needed to describe the transformation. More...
 
int interpolation
 Type of interpolation used. More...
 
PrecisionType warpedPaddingValue
 Padding value for the warped image. More...
 
nifti_image * deformationVectorFieldImage
 The deformation vector field image. More...
 

Private Attributes

int lastInitialisedLevel
 The level taht was last requested to be initialised. More...
 
unsigned int numberOfLevelsToPerform
 The total number of levels that are used to fit the model. Parameter needed to correctly scale constraints. More...
 

Detailed Description

Class implementing the standard b-spline transformation

Member Typedef Documentation

◆ PrecisionType

Constructor & Destructor Documentation

◆ BSplineTransformation() [1/2]

BSplineTransformation::BSplineTransformation ( nifti_image *  referenceImageIn,
unsigned int  numberOfLevelsToPerform,
float *  finalControlPointGridSpacing 
)

Constructor. Requires the reference image to define the space in which the transformation is valid, the number of levels to update the bending energy correctly as well as the final control-point grid spacing.

Parameters
referenceImageInPointer to the reference image
numberOfLevelsToPerformNumber of levels to perform
finalControlPointGridSpacingPointer to the final control-point grid spacing if negative, the spacing is assumed to be given as multiples of the voxel spacing

◆ BSplineTransformation() [2/2]

BSplineTransformation::BSplineTransformation ( const BSplineTransformation transformToCopy)

Copy constructor.

Parameters
transformToCopyReference to the B-spline transformation object to copy

◆ ~BSplineTransformation()

BSplineTransformation::~BSplineTransformation ( )

Destructor.

Member Function Documentation

◆ CPGToDVF2D()

void BSplineTransformation::CPGToDVF2D ( nifti_image *  denseVectorFieldImage)
protected

Compute a dense vector field (DVF) from a B-spline control point grid (CPG). This function assumes the axes of the DVF is aligned with axes of the CPG

Parameters
denseVectorFieldImageA nifti image that will be filled with the DVF

◆ CPGToDVF3D()

void BSplineTransformation::CPGToDVF3D ( nifti_image *  denseVectorFieldImage)
protected

Compute a dense vector field (DVF) from a B-spline control point grid (CPG). This function assumes the axes of the DVF is aligned with axes of the CPG

Parameters
denseVectorFieldImageA nifti image that will be filled with the DVF

◆ DeepCopy()

std::shared_ptr< Transformation > BSplineTransformation::DeepCopy ( )
virtual

Function to create a deep copy of this object.

Implements Transformation.

◆ DisplayTransformationParameters()

void BSplineTransformation::DisplayTransformationParameters ( )
virtual

Display function to print the transformation parameters to the standard output

Implements Transformation.

◆ DVFToCPG2D()

void BSplineTransformation::DVFToCPG2D ( nifti_image *  controlPointGridImage,
nifti_image *  denseVectorFieldImage,
bool  normaliseKernel 
)
protected

Compute a B-spline control point grid (CPG) from the B-spline convolution of a dense 2D vector field (DVF), i.e. the CPG will be the B-spline parameterisation that best approximates the DVF. This function assumes the axes of the DVF are aligned with axes of the CPG

Parameters
controlPointGridImageA nifti image that will be filled with the B-spline CPG
denseVectorFieldImageA nifti image containing the DVF
normaliseKernelIf true each B-spline kernel will be normalised to have a sum of 1

◆ DVFToCPG3D()

void BSplineTransformation::DVFToCPG3D ( nifti_image *  controlPointGridImage,
nifti_image *  denseVectorFieldImage,
bool  normaliseKernel 
)
protected

Compute a B-spline control point grid (CPG) from the B-spline convolution of a dense 3D vector field (DVF), i.e. the CPG will be the B-spline parameterisation that best approximates the DVF. This function assumes the axes of the DVF are aligned with axes of the CPG

Parameters
controlPointGridImageA nifti image that will be filled with the B-spline CPG
denseVectorFieldImageA nifti image containing the DVF
normaliseKernelIf true each B-spline kernel will be normalised to have a sum of 1

◆ GetConstraintGradientWRTTransformationParameters()

BSplineTransformation::PrecisionType * BSplineTransformation::GetConstraintGradientWRTTransformationParameters ( )
virtual

Calculate the gradient of the constraint term (regularisation) for the transformation with the current parameters.

Implements Transformation.

◆ GetConstraintValue()

double BSplineTransformation::GetConstraintValue ( )
virtual

Get the constraint value for the transformation with the current parametes.

Implements Transformation.

◆ GetCopyOfParameters()

BSplineTransformation::PrecisionType * BSplineTransformation::GetCopyOfParameters ( )
virtual

Get a pointer to a copy of the current transformation parameters. Receiving function will need to free the memory after usage.

Implements Transformation.

◆ GetDeformationVectorField()

nifti_image * BSplineTransformation::GetDeformationVectorField ( nifti_image *  targetImageIn)
virtual

For a given target image, calculate a deformation field.

Parameters
targetImageInThe target image defines the geometry of the DVF, or the voxel locations for which deformation vectors are calculated.

Implements Transformation.

◆ GetDVFGradientWRTTransformationParameters()

BSplineTransformation::PrecisionType * BSplineTransformation::GetDVFGradientWRTTransformationParameters ( nifti_image *  denseDVFIn)
virtual

Calculates the gradient of an image for a given deformation vector field.

Parameters
denseDVFInDeformation vector field

Implements Transformation.

◆ GetMaxTransformationParameterLength()

BSplineTransformation::PrecisionType BSplineTransformation::GetMaxTransformationParameterLength ( PrecisionType parametersIn)
virtual

Calculate the maximum control-point displacement value for the given transformation parametes.

Implements Transformation.

◆ GetSumOfPenaltyWeights()

BSplineTransformation::PrecisionType BSplineTransformation::GetSumOfPenaltyWeights ( )
virtual

Calculates the sum of the penalty term weights. Curretnly the bending energy weight and the linear energy weight are added. Responsibility of the correct scaling of the penalty term lies with the generating function.

Implements Transformation.

◆ GetTransformationAsImage()

std::vector< nifti_image * > BSplineTransformation::GetTransformationAsImage ( )
virtual

Returns the b-spline control-point grind as an image.

Implements Transformation.

◆ InitialiseLevel()

void BSplineTransformation::InitialiseLevel ( unsigned int  level)
virtual

Initialise a given level, i.e. perform a grid refinement. If the same level was initialised before, no refinement will be performed. Currently it is not checked, if a coarser level is requested.

Parameters
levelDefines the level that is to be initialised.

Implements Transformation.

◆ SetBendingEnergyWeight()

void BSplineTransformation::SetBendingEnergyWeight ( double  bendingEnergyWeightIn)

B-spline specific regularisation term weight. Penalises the bending energy.

Parameters
bendingEnergyWeightInInput weight

◆ SetLinearEnergyWeight()

void BSplineTransformation::SetLinearEnergyWeight ( double  linearEnergyWeightIn)

B-spline specific regularisation term weight. Penalises the linear energy.

Parameters
linearEnergyWeightInInput weight

◆ SetParameters()

void BSplineTransformation::SetParameters ( BSplineTransformation::PrecisionType parametersIn,
bool  parametersAreDisplacements 
)
virtual

Set the parameters that define the b-spline transformation.

Parameters
parametersInPointer to the parameters that will be copied to the internal transformation parameters.
parametersAreDisplacementsSet to true if the parameters are displacements (i.e. relative to control-point position and NOT absolute positions)

Implements Transformation.

Member Data Documentation

◆ bendingEnergyWeight

double BSplineTransformation::bendingEnergyWeight
protected

The bending-energy weight.

◆ controlPointGridImage

nifti_image* BSplineTransformation::controlPointGridImage
protected

‍** Function to reorientate vectors in 5D nifti image.

The control-point grid image

◆ lastInitialisedLevel

int BSplineTransformation::lastInitialisedLevel
private

The level taht was last requested to be initialised.

◆ linearEnergyWeight

double BSplineTransformation::linearEnergyWeight
protected

The linear energy weight.

◆ numberOfLevelsToPerform

unsigned int BSplineTransformation::numberOfLevelsToPerform
private

The total number of levels that are used to fit the model. Parameter needed to correctly scale constraints.


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