SuPReMo
0.1.1
|
#include <BSplineTransformation.h>
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::PrecisionType * | GetDVFGradientWRTTransformationParameters (nifti_image *denseDVFIn) |
virtual BSplineTransformation::PrecisionType * | GetConstraintGradientWRTTransformationParameters () |
double | GetConstraintValue () |
virtual PrecisionType * | GetCopyOfParameters () |
void | SetLinearEnergyWeight (double linearEnergyWeightIn) |
void | SetBendingEnergyWeight (double bendingEnergyWeightIn) |
std::shared_ptr< Transformation > | DeepCopy () |
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 PrecisionType * | GetCopyOfParameters ()=0 |
virtual unsigned int | GetNumberOfParameters () |
virtual void | SetParameters (PrecisionType *paramsIn, bool parametersAreDisplacements)=0 |
virtual nifti_image * | GetDeformationVectorField (nifti_image *targetImageIn)=0 |
virtual PrecisionType * | GetDVFGradientWRTTransformationParameters (nifti_image *denseDVFIn)=0 |
virtual PrecisionType * | GetConstraintGradientWRTTransformationParameters ()=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< Transformation > | DeepCopy ()=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... | |
Class implementing the standard b-spline transformation
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.
referenceImageIn | Pointer to the reference image |
numberOfLevelsToPerform | Number of levels to perform |
finalControlPointGridSpacing | Pointer to the final control-point grid spacing if negative, the spacing is assumed to be given as multiples of the voxel spacing |
BSplineTransformation::BSplineTransformation | ( | const BSplineTransformation & | transformToCopy | ) |
Copy constructor.
transformToCopy | Reference to the B-spline transformation object to copy |
BSplineTransformation::~BSplineTransformation | ( | ) |
Destructor.
|
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
denseVectorFieldImage | A nifti image that will be filled with the DVF |
|
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
denseVectorFieldImage | A nifti image that will be filled with the DVF |
|
virtual |
Function to create a deep copy of this object.
Implements Transformation.
|
virtual |
Display function to print the transformation parameters to the standard output
Implements Transformation.
|
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
controlPointGridImage | A nifti image that will be filled with the B-spline CPG |
denseVectorFieldImage | A nifti image containing the DVF |
normaliseKernel | If true each B-spline kernel will be normalised to have a sum of 1 |
|
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
controlPointGridImage | A nifti image that will be filled with the B-spline CPG |
denseVectorFieldImage | A nifti image containing the DVF |
normaliseKernel | If true each B-spline kernel will be normalised to have a sum of 1 |
|
virtual |
Calculate the gradient of the constraint term (regularisation) for the transformation with the current parameters.
Implements Transformation.
|
virtual |
Get the constraint value for the transformation with the current parametes.
Implements Transformation.
|
virtual |
Get a pointer to a copy of the current transformation parameters. Receiving function will need to free the memory after usage.
Implements Transformation.
|
virtual |
For a given target image, calculate a deformation field.
targetImageIn | The target image defines the geometry of the DVF, or the voxel locations for which deformation vectors are calculated. |
Implements Transformation.
|
virtual |
Calculates the gradient of an image for a given deformation vector field.
denseDVFIn | Deformation vector field |
Implements Transformation.
|
virtual |
Calculate the maximum control-point displacement value for the given transformation parametes.
Implements Transformation.
|
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.
|
virtual |
Returns the b-spline control-point grind as an image.
Implements Transformation.
|
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.
level | Defines the level that is to be initialised. |
Implements Transformation.
void BSplineTransformation::SetBendingEnergyWeight | ( | double | bendingEnergyWeightIn | ) |
B-spline specific regularisation term weight. Penalises the bending energy.
bendingEnergyWeightIn | Input weight |
void BSplineTransformation::SetLinearEnergyWeight | ( | double | linearEnergyWeightIn | ) |
B-spline specific regularisation term weight. Penalises the linear energy.
linearEnergyWeightIn | Input weight |
|
virtual |
Set the parameters that define the b-spline transformation.
parametersIn | Pointer to the parameters that will be copied to the internal transformation parameters. |
parametersAreDisplacements | Set to true if the parameters are displacements (i.e. relative to control-point position and NOT absolute positions) |
Implements Transformation.
|
protected |
The bending-energy weight.
|
protected |
** Function to reorientate vectors in 5D nifti image.
The control-point grid image
|
private |
The level taht was last requested to be initialised.
|
protected |
The linear energy weight.
|
private |
The total number of levels that are used to fit the model. Parameter needed to correctly scale constraints.