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

#include <SlidingTransformation.h>

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

Public Types

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

Public Member Functions

 SlidingTransformation (std::shared_ptr< Transformation >transformationAIn, std::shared_ptr< Transformation >transformationBIn, nifti_image *defSpaceImage, unsigned int numberOfLevels, unsigned int numberOfLevelsToPerform)
 
 SlidingTransformation (const SlidingTransformation &transformToCopy)
 
 ~SlidingTransformation ()
 
virtual void InitialiseLevel (unsigned int level)
 
void SetParameters (PrecisionType *parametersIn, bool parametersAreDisplacements)
 
virtual nifti_image * GetDeformationVectorField (nifti_image *targetImageIn)
 
virtual SlidingTransformation::PrecisionTypeGetDVFGradientWRTTransformationParameters (nifti_image *denseDVFIn)
 
virtual SlidingTransformation::PrecisionTypeGetConstraintGradientWRTTransformationParameters ()
 
double GetConstraintValue ()
 
virtual PrecisionTypeGetCopyOfParameters ()
 
std::shared_ptr< TransformationDeepCopy ()
 
void DisplayTransformationParameters ()
 
virtual PrecisionType GetSumOfPenaltyWeights ()
 
virtual PrecisionType GetMaxTransformationParameterLength (PrecisionType *parametersIn)
 
std::vector< nifti_image * > GetTransformationAsImage ()
 
void SetGapOverlapConstraintWeight (double gapOverlabConstraintWeightIn)
 
void SetSignedDistanceMapImage (nifti_image *signedDistanceMapImageIn)
 
- 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 ()
 

Private Member Functions

void ClearSignedDistanceMap ()
 
void ClearTransformedSignedDistanceMaps ()
 
void AllocateTransformedSignedDistanceMaps (nifti_image *targetImage)
 
double CalculateGapOverlapConstraintTerm ()
 
bool TransformedSignedDistMapsCanBeUsedForConstraintCalculations ()
 

Private Attributes

std::shared_ptr< TransformationtransformA
 The transformation defining the inside, i.e. SDT < 0. More...
 
std::shared_ptr< TransformationtransformB
 The transformation defining the outside, i.e. SDT > 0. More...
 
nifti_image * signedDistMapImage
 Nifti image holding the singed distance image in source-image space for the current level. More...
 
std::shared_ptr< ImagePyramid< PrecisionType > > defSpaceImagePyramid
 The image pyramid holding the images in which the transformation is defined. Should correspond with those used to initilase the transfomrations A and B. Will be generated during construction. More...
 
nifti_image * curDefSpaceImage
 Pointer to the current image within the defSpaceImagePyramid.
More...
 
int lastInitialisedLevel
 The last initialised level. This determines which level of the def space image pyramid is accessed. Will be set to -1 before initialisation. More...
 
nifti_image * signedDistMapImageTransformedA
 Nfiti image holdeing the signed distance map transformed with transformA. More...
 
nifti_image * signedDistMapImageTransformedB
 Nfiti image holdeing the signed distance map transformed with transformA. More...
 
double gapOverlapConstraintWeight
 The gap-overlap-constraint weight. More...
 

Additional Inherited Members

- 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 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...
 

Detailed Description

Class implementing the sliding transformation

Member Typedef Documentation

◆ PrecisionType

Constructor & Destructor Documentation

◆ SlidingTransformation() [1/2]

SlidingTransformation::SlidingTransformation ( std::shared_ptr< Transformation transformationAIn,
std::shared_ptr< Transformation transformationBIn,
nifti_image *  defSpaceImage,
unsigned int  numberOfLevels,
unsigned int  numberOfLevelsToPerform 
)

Constructor to generate a sliding transformation object.

The sliding transformation is defined by two individual transformation objects, i.e. transformationA and transformationB.

Parameters
transformationAInPointer to the first transformation.
transformationBInPointer to the second transformation.
defSpaceImageImage defining the area where the sliding-transformation specific constraint term will be calculated.
numberOfLevelsNumber of pyramid levels. Required to correctly calculate the image pyramid of defSpaceImage.
numberOfLevelsToPerformNumber of levels to perform. See numberOfLevels.

◆ SlidingTransformation() [2/2]

SlidingTransformation::SlidingTransformation ( const SlidingTransformation transformToCopy)

Copy constructor.

Parameters
transformToCopyReference to the sliding transformation object to copy.

◆ ~SlidingTransformation()

SlidingTransformation::~SlidingTransformation ( )

Destructor.

Member Function Documentation

◆ AllocateTransformedSignedDistanceMaps()

void SlidingTransformation::AllocateTransformedSignedDistanceMaps ( nifti_image *  targetImage)
private

Allocate the transfomred signed distance maps

Parameters
targetImageThe target image defines the size of the allocated signed distance maps.

◆ CalculateGapOverlapConstraintTerm()

double SlidingTransformation::CalculateGapOverlapConstraintTerm ( )
private

Calculate the gap and overlap constraint term from the transfomred signed distance maps.

Note
The function GetDeformationVectorField() has to be called before this can be computed.

◆ ClearSignedDistanceMap()

void SlidingTransformation::ClearSignedDistanceMap ( )
private

Delete this objet's copy of the signed distance image used.

◆ ClearTransformedSignedDistanceMaps()

void SlidingTransformation::ClearTransformedSignedDistanceMaps ( )
private

Delete the transfomred signed distance maps

◆ DeepCopy()

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

Function to create a deep copy of this object.

Implements Transformation.

◆ DisplayTransformationParameters()

void SlidingTransformation::DisplayTransformationParameters ( )
virtual

Display function to print the transformation parameters to the standard output

Implements Transformation.

◆ GetConstraintGradientWRTTransformationParameters()

SlidingTransformation::PrecisionType * SlidingTransformation::GetConstraintGradientWRTTransformationParameters ( )
virtual

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

Implements Transformation.

◆ GetConstraintValue()

double SlidingTransformation::GetConstraintValue ( )
virtual

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

Implements Transformation.

◆ GetCopyOfParameters()

SlidingTransformation::PrecisionType * SlidingTransformation::GetCopyOfParameters ( )
virtual

Return a pointer to the parameters of the transformation

Implements Transformation.

◆ GetDeformationVectorField()

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

For a given target image, calculate a deformation vector field (DVF).

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

ToDo: make parallel

Implements Transformation.

◆ GetDVFGradientWRTTransformationParameters()

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

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

Parameters
denseDVFInDeformation vector field

Implements Transformation.

◆ GetMaxTransformationParameterLength()

SlidingTransformation::PrecisionType SlidingTransformation::GetMaxTransformationParameterLength ( PrecisionType parametersIn)
virtual

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

Implements Transformation.

◆ GetSumOfPenaltyWeights()

SlidingTransformation::PrecisionType SlidingTransformation::GetSumOfPenaltyWeights ( )
virtual

Calculates the sum of the penalty term weights. Responsibility of the correct scaling of the penalty term lies with the generating function.

Implements Transformation.

◆ GetTransformationAsImage()

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

Returns the transformation as an image.

Implements Transformation.

◆ InitialiseLevel()

void SlidingTransformation::InitialiseLevel ( unsigned int  level)
virtual

Initialise a given level. Call the initialisation for the individual transformations and update the current defSpaceImage.

Parameters
levelDefines the level that is to be initialised.

Implements Transformation.

◆ SetGapOverlapConstraintWeight()

void SlidingTransformation::SetGapOverlapConstraintWeight ( double  gapOverlabConstraintWeightIn)

Set the sliding-transformation specific constraint weight. Higher values will result in less gaps and overlaps.

Parameters
gapOverlabConstraintWeightInWeight of the gap-overlap constraint term.

◆ SetParameters()

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

Set the parameters that define the sliding transformation.

Parameters
parametersInPointer to the parameters that will be copied to the internal transformation parameters.
parametersAreDisplacementsSet to true if the parameters are displacements.

Implements Transformation.

◆ SetSignedDistanceMapImage()

void SlidingTransformation::SetSignedDistanceMapImage ( nifti_image *  signedDistanceMapImageIn)

Set the signed distance map image used to determine the sliding boundary. This function generates a local copy of this image

Parameters
signedDistanceMapImageInNifti image of the signed distance map in the source image space.

◆ TransformedSignedDistMapsCanBeUsedForConstraintCalculations()

bool SlidingTransformation::TransformedSignedDistMapsCanBeUsedForConstraintCalculations ( )
private

Checks the geometry of the transformed signed distance map and the (current) image defining the space where the sliding constraint is calculated.

Member Data Documentation

◆ curDefSpaceImage

nifti_image* SlidingTransformation::curDefSpaceImage
private

Pointer to the current image within the defSpaceImagePyramid.

◆ defSpaceImagePyramid

std::shared_ptr<ImagePyramid<PrecisionType> > SlidingTransformation::defSpaceImagePyramid
private

The image pyramid holding the images in which the transformation is defined. Should correspond with those used to initilase the transfomrations A and B. Will be generated during construction.

◆ gapOverlapConstraintWeight

double SlidingTransformation::gapOverlapConstraintWeight
private

The gap-overlap-constraint weight.

◆ lastInitialisedLevel

int SlidingTransformation::lastInitialisedLevel
private

The last initialised level. This determines which level of the def space image pyramid is accessed. Will be set to -1 before initialisation.

◆ signedDistMapImage

nifti_image* SlidingTransformation::signedDistMapImage
private

Nifti image holding the singed distance image in source-image space for the current level.

◆ signedDistMapImageTransformedA

nifti_image* SlidingTransformation::signedDistMapImageTransformedA
private

Nfiti image holdeing the signed distance map transformed with transformA.

◆ signedDistMapImageTransformedB

nifti_image* SlidingTransformation::signedDistMapImageTransformedB
private

Nfiti image holdeing the signed distance map transformed with transformA.

◆ transformA

std::shared_ptr<Transformation> SlidingTransformation::transformA
private

The transformation defining the inside, i.e. SDT < 0.

◆ transformB

std::shared_ptr<Transformation> SlidingTransformation::transformB
private

The transformation defining the outside, i.e. SDT > 0.


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