Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mirtk::FreeFormTransformation Class Referenceabstract

#include <FreeFormTransformation.h>

Inheritance diagram for mirtk::FreeFormTransformation:
Inheritance graph
Collaboration diagram for mirtk::FreeFormTransformation:
Collaboration graph

Public Types

typedef GenericExtrapolateImageFunction< CPImageCPExtrapolator
 Base type used for extrapolation of control point data.
 
typedef GenericImage< CPValueCPImage
 Type of image representation of free-form transformation.
 
typedef GenericInterpolateImageFunction< CPImageCPInterpolator
 
typedef Vector3D< DOFStatusCPStatus
 Type of vector storing status of control point coefficients.
 
typedef Vector3D< DOFValueCPValue
 Type of vector storing the coefficients at a control point.
 
typedef CPValue Vector
 
- Public Types inherited from mirtk::Transformation
typedef Status DOFStatus
 Type of transforamtion parameter status.
 
typedef double DOFValue
 Type of transformation parameter value.
 

Public Member Functions

int ActualNumberOfDOFs () const
 
virtual double Approximate (const Transformation *, int=1, double=.0)
 
virtual double Approximate (const ImageAttributes &, double *, double *, double *, int=1, double=.0)
 
virtual double Approximate (const double *, const double *, const double *, double *, double *, double *, int, int=1, double=.0)
 
virtual double Approximate (const double *, const double *, const double *, const double *, double *, double *, double *, int, int=1, double=.0)
 
virtual double ApproximateAsNew (const Transformation *, int=1, double=.0)
 Approximate another transformation and return approximation error.
 
virtual double ApproximateAsNew (const ImageAttributes &, double *, double *, double *, int=1, double=.0)
 
virtual ImageAttributes ApproximationDomain (const ImageAttributes &, const Transformation *)
 
const ImageAttributesAttributes () const
 Returns attributes of control point grid.
 
virtual double BendingEnergy (double, double, double, double=0, double=NaN, bool=true) const
 Calculates the bending of the transformation.
 
virtual double BendingEnergy (bool=false, bool=true) const
 Approximates the bending energy on the control point lattice.
 
virtual double BendingEnergy (const ImageAttributes &attr, double=NaN, bool=true) const
 Approximates the bending energy on the specified discrete domain.
 
virtual void BendingEnergyGradient (double *, double=1.0, bool=false, bool=true, bool=true) const
 
void BoundingBox (double &, double &) const
 Gets the temporal bounding box of the free-form deformation (in ms)
 
void BoundingBox (double &, double &, double &, double &, double &, double &) const
 Gets the spatial bounding box of the free-form deformation (in mm)
 
void BoundingBox (Point &, Point &) const
 Gets the spatial bounding box of the free-form deformation (in mm)
 
void BoundingBox (double &, double &, double &, double &, double &, double &, double &, double &) const
 Gets the spatio-temporal bounding box of the free-form deformation (in mm and ms)
 
void BoundingBox (Point &, double &, Point &, double &) const
 Gets the spatio-temporal bounding box of the free-form deformation (in mm and ms)
 
virtual void BoundingBox (int, double &, double &, double=1) const
 
virtual void BoundingBox (int, double &, double &, double &, double &, double &, double &, double=1) const =0
 
virtual void BoundingBox (int, double &, double &, double &, double &, double &, double &, double &, double &, double=1) const
 
void BoundingBox (int, Point &, Point &, double=1) const
 
bool BoundingBox (const ImageAttributes &, int, int &, int &, int &, int &, int &, int &, double=1) const
 
bool BoundingBox (const ImageAttributes &, int, int &, int &, int &, int &, int &, int &, int &, int &, double=1) const
 
bool BoundingBox (const Image *, int, int &, int &, int &, int &, int &, int &, double=1) const
 
bool BoundingBox (const Image *, int, int &, int &, int &, int &, int &, int &, int &, int &, double=1) const
 
void ControlPointLocation (int, double &, double &) const
 Gets the location of the given control point (in mm)
 
void ControlPointLocation (int, double &, double &, double &) const
 Gets the location of the given control point (in mm)
 
Point ControlPointLocation (int) const
 Returns the location of the given control point (in mm)
 
virtual bool CopyFrom (const Transformation *)
 
bool CropPadPassiveCPs (int=0, bool=false)
 
virtual bool CropPadPassiveCPs (int, int, int=0, int=0, bool=false)
 
bool DOFBoundingBox (const ImageAttributes &, int, int &, int &, int &, int &, int &, int &, double=1) const
 
bool DOFBoundingBox (const Image *, int, int &, int &, int &, int &, int &, int &, double=1) const
 
virtual double DOFGradientNorm (const double *) const
 Get norm of the gradient vector.
 
int DOFToDimension (int) const
 Get index of dimension corresponding to transformation parameter (DoFs)
 
int DOFToIndex (int) const
 Get index of control point corresponding to transformation parameter (DoFs)
 
double EvaluateRMSError (const Transformation *) const
 Evaluates RMS error of transformation at control points compared to another.
 
virtual void ExtrapolationMode (enum ExtrapolationMode)
 Set extrapolation mode.
 
const CPExtrapolatorExtrapolator () const
 
virtual void FFDJacobianDetDerivative (double dJ[3], const Matrix &adj, int cp, double x, double y, double z, double=0, double=NaN, bool wrt_world=true, bool use_spacing=true) const
 
virtual void FFDJacobianWorld (Matrix &, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the transformation w.r.t either control point displacements or velocities.
 
void Get (int, Vector &) const
 Gets values of the parameters at a control point.
 
void Get (int, double &, double &, double &) const
 Gets values of the parameters at a control point.
 
void Get (int, int, int, double &, double &, double &) const
 Gets values of the parameters at a control point.
 
void Get (int, int, int, int, double &, double &, double &) const
 Gets values of the parameters at a control point.
 
void GetOrientation (double *, double *, double *) const
 Gets the orientation of the free-form deformation lattice.
 
void GetSpacing (double &, double &, double &) const
 Gets the control point spacing (in mm)
 
void GetSpacing (double &, double &, double &, double &) const
 Gets the control point spacing (in mm)
 
void GetStatus (int, CPStatus &) const
 Gets status of the parameters at a control point.
 
void GetStatus (int, int, int, DOFStatus &, DOFStatus &, DOFStatus &) const
 Gets status of the parameters at a control point.
 
void GetStatus (int, int, int, int, DOFStatus &, DOFStatus &, DOFStatus &) const
 Gets status of the parameters at a control point.
 
int GetT () const
 Returns the number of control points in t.
 
virtual int GetTAfterSubdivision () const
 Returns the number of control points in t after subdivision.
 
double GetTSpacing () const
 Returns the of control point spacing in t.
 
virtual double GetTSpacingAfterSubdivision () const
 Returns the control point spacing in t after the subdivision.
 
int GetX () const
 Returns the number of control points in x.
 
virtual int GetXAfterSubdivision () const
 Returns the number of control points in x after subdivision.
 
double GetXSpacing () const
 Returns the of control point spacing in x.
 
virtual double GetXSpacingAfterSubdivision () const
 Returns the control point spacing in x after the subdivision.
 
int GetY () const
 Returns the number of control points in y.
 
virtual int GetYAfterSubdivision () const
 Returns the number of control points in y after subdivision.
 
double GetYSpacing () const
 Returns the of control point spacing in y.
 
virtual double GetYSpacingAfterSubdivision () const
 Returns the control point spacing in y after the subdivision.
 
int GetZ () const
 Returns the number of control points in z.
 
virtual int GetZAfterSubdivision () const
 Returns the number of control points in z after subdivision.
 
double GetZSpacing () const
 Returns the of control point spacing in z.
 
virtual double GetZSpacingAfterSubdivision () const
 Returns the control point spacing in z after the subdivision.
 
virtual void GlobalHessian (Matrix [3], double, double, double, double=0, double=NaN) const
 Calculates the Hessian for each component of the global transformation w.r.t world coordinates.
 
virtual void GlobalInverse (double &, double &, double &, double=0, double=NaN) const
 Transforms a single point using the inverse of the global transformation only.
 
virtual void GlobalJacobian (Matrix &, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the global transformation w.r.t world coordinates.
 
virtual void GlobalTransform (double &, double &, double &, double=0, double=NaN) const
 Transforms a single point using the global transformation component only.
 
virtual void Hessian (Matrix [3], double, double, double, double=0, double=NaN) const
 Calculates the Hessian for each component of the transformation w.r.t world coordinates.
 
void HessianToWorld (double &, double &, double &) const
 
void HessianToWorld (double &, double &, double &, double &, double &, double &) const
 
void HessianToWorld (Matrix &) const
 
void HessianToWorld (Matrix [3]) const
 
void IndexToDOFs (int, int &, int &) const
 Get indices of transformation parameters (DoFs)
 
void IndexToDOFs (int, int &, int &, int &) const
 Get indices of transformation parameters (DoFs)
 
void IndexToLattice (int, int &, int &) const
 Get control point lattice coordinates from index.
 
void IndexToLattice (int, int &, int &, int &) const
 Get control point lattice coordinates from index.
 
void IndexToLattice (int, int &, int &, int &, int &) const
 Get control point lattice coordinates from index.
 
void IndexToWorld (int, double &, double &) const
 Get world coordinates (in mm) of control point.
 
void IndexToWorld (int, double &, double &, double &) const
 Get world coordinates (in mm) of control point.
 
void IndexToWorld (int, Point &) const
 Get world coordinates (in mm) of control point.
 
Point IndexToWorld (int) const
 Get world coordinates (in mm) of control point.
 
virtual void Initialize (const ImageAttributes &)=0
 Initialize free-form transformation.
 
void Initialize (const ImageAttributes &, double, double, double=-1.0, double=-1.0)
 Initialize free-form transformation.
 
void Initialize (const CPImage &, bool=false)
 Initialize transformation from existing vector field.
 
void Initialize (const GenericImage< double > &, bool=false)
 Initialize transformation from existing 3D+t vector field.
 
virtual void Interpolate (const double *, const double *, const double *)=0
 
virtual bool Inverse (double &, double &, double &, double=0, double=NaN) const
 Transforms a single point using the inverse of the transformation.
 
virtual bool IsActive (int) const
 Whether the control point at given lattice index is active.
 
virtual bool IsActive (int, int, int=0, int=0) const
 Whether the control point at given lattice coordinates is active.
 
virtual void Jacobian (Matrix &, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the transformation w.r.t world coordinates.
 
virtual void JacobianDetDerivative (double dJ[3], const Matrix &adj, int cp, double x, double y, double z, double t=0, double t0=NaN, bool wrt_world=true, bool use_spacing=true) const
 
virtual void JacobianDOFs (Matrix &, int, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the transformation w.r.t the transformation parameters of a control point.
 
virtual void JacobianDOFs (TransformationJacobian &, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the transformation w.r.t the transformation parameters.
 
void JacobianToWorld (double &, double &) const
 
void JacobianToWorld (double &, double &, double &) const
 
void JacobianToWorld (Matrix &) const
 
void JacobianToWorldOrientation (double &, double &) const
 Reorient 1st order derivatives computed w.r.t 2D lattice coordinates.
 
void JacobianToWorldOrientation (double &, double &, double &) const
 Reorient 1st order derivatives computed w.r.t 2D lattice coordinates.
 
int KernelRadius () const
 Radius of support region of the used kernel.
 
virtual int KernelSize () const =0
 Size of support region of the used kernel.
 
int LatticeToIndex (int, int, int=0, int=0) const
 Get control point index from lattice coordinates.
 
virtual double LatticeToTime (double) const
 Transforms temporal lattice coordinate to time (in ms)
 
virtual void LatticeToWorld (double &, double &) const
 Transforms lattice coordinates to world coordinates (in mm)
 
virtual void LatticeToWorld (double &, double &, double &) const
 Transforms lattice coordinates to world coordinates (in mm)
 
virtual void LatticeToWorld (Point &) const
 Transforms lattice coordinates to world coordinates (in mm)
 
 mirtkPublicAttributeMacro (double, SpeedupFactor)
 Speedup factor for gradient computation.
 
 mirtkReadOnlyAttributeMacro (enum ExtrapolationMode, ExtrapolationMode)
 Mode used for extrapolation of control point image.
 
int NumberOfActiveCPs () const
 Number of active control points.
 
int NumberOfCPs () const
 Number of control points.
 
int NumberOfPassiveCPs () const
 Number of non-active control points.
 
virtual ParameterList Parameter () const
 Get (non-DoF) parameters as key/value as string map.
 
virtual void ParametricGradient (const GenericImage< double > *, double *, const WorldCoordsImage *, const WorldCoordsImage *, double=NaN, double=1) const
 
virtual void ParametricGradient (const PointSet &, const Vector3D< double > *, double *, double=0, double=NaN, double=1) const
 
virtual void Print (ostream &, Indent=0) const
 Prints the parameters of the transformation.
 
void Put (int, const Vector &)
 Puts values of the parameters at a control point.
 
void Put (int, double, double, double)
 Puts values of the parameters at a control point.
 
void Put (int, int, int, double, double, double)
 Puts values of the parameters at a control point.
 
void Put (int, int, int, int, double, double, double)
 Puts values of the parameters at a control point.
 
void PutBoundingBox (double, double, double, double, double, double)
 Puts the spatial bounding box for the free-form deformation (in mm)
 
void PutBoundingBox (const Point &, const Point &)
 Puts the temporal bounding box for the free-form deformation (in mm)
 
void PutBoundingBox (double, double)
 Puts the temporal bounding box of the free-form deformation (in ms)
 
void PutBoundingBox (double, double, double, double, double, double, double, double)
 Puts the spatio-temporal bounding box for the free-form deformation (in mm)
 
void PutOrientation (double *, double *, double *)
 Puts the orientation of the free-form deformation lattice.
 
void PutStatus (int, const CPStatus &)
 Puts status of the parameters at a control point.
 
void PutStatus (int, int, int, DOFStatus, DOFStatus, DOFStatus)
 Puts status of the parameters at a control point.
 
void PutStatus (int, int, int, int, DOFStatus, DOFStatus, DOFStatus)
 Puts status of the parameters at a control point.
 
virtual bool Set (const char *, const char *)
 Set named (non-DoF) parameter from value as string.
 
virtual void Subdivide (bool=true, bool=true, bool=true, bool=true)
 Subdivide lattice of free-form transformation.
 
void Subdivide2D ()
 Subdivide lattice in first two dimensions.
 
void Subdivide3D ()
 Subdivide lattice in first three dimensions.
 
void Subdivide4D ()
 Subdivide lattice in all four dimensions.
 
int T () const
 Returns the number of control points in t.
 
virtual double TimeToLattice (double) const
 Transforms time (in ms) to temporal lattice coordinate.
 
virtual void Transform (double &, double &, double &, double=0, double=NaN) const
 Transforms a single point.
 
virtual void WorldToLattice (double &, double &) const
 Transforms world coordinates (in mm) to lattice coordinates.
 
virtual void WorldToLattice (double &, double &, double &) const
 Transforms world coordinates (in mm) to lattice coordinates.
 
virtual void WorldToLattice (Point &) const
 Transforms world coordinates (in mm) to lattice coordinates.
 
int X () const
 Returns the number of control points in x.
 
int Y () const
 Returns the number of control points in y.
 
int Z () const
 Returns the number of control points in z.
 
virtual ~FreeFormTransformation ()
 Destructor.
 
- Public Member Functions inherited from mirtk::Transformation
virtual void Add (const DOFValue *)
 Add change to transformation parameters.
 
virtual double Approximate (const ImageAttributes &, const Transformation *, int=1, double=.0)
 Approximate another transformation and return approximation error.
 
virtual double Approximate (GenericImage< double > &, int=1, double=.0)
 
virtual double ApproximateAsNew (const ImageAttributes &, const Transformation *, int=1, double=.0)
 Approximate another transformation and return approximation error.
 
virtual double ApproximateAsNew (GenericImage< double > &, int=1, double=.0)
 
virtual double ApproximateAsNew (const double *, const double *, const double *, double *, double *, double *, int, int=1, double=.0)
 
virtual double ApproximateAsNew (const double *, const double *, const double *, const double *, double *, double *, double *, int, int=1, double=.0)
 
virtual void ApproximateDOFs (const double *, const double *, const double *, const double *, const double *, const double *, const double *, int)
 
virtual void ApproximateDOFsGradient (const double *, const double *, const double *, const double *, const double *, const double *, const double *, int, double *, double=1.0) const
 
virtual void ApproximateGradient (const ImageAttributes &, const double *, const double *, const double *, double *, double=1.0) const
 
virtual void ApproximateGradient (const double *, const double *, const double *, const double *, const double *, const double *, int, double *, double=1.0) const
 
virtual void ApproximateGradient (const double *, const double *, const double *, const double *, const double *, const double *, const double *, int, double *, double=1.0) const
 
virtual bool CanModifyDisplacement (int=-1) const
 
virtual bool CanRead (TransformationType) const
 Whether this transformation can read a file of specified type (i.e. format)
 
virtual void DeriveJacobianWrtDOF (Matrix &, int, double, double, double, double=0, double=NaN) const
 Calculates the derivative of the Jacobian of the transformation (w.r.t. world coordinates) w.r.t. a transformation parameter.
 
virtual void Displacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point.
 
virtual void Displacement (const ImageAttributes &, double *, double *, double *) const
 
virtual void Displacement (GenericImage< double > &, double=NaN, const WorldCoordsImage *=NULL) const
 Calculates the displacement vectors for a whole image domain.
 
virtual void Displacement (GenericImage< float > &, double=NaN, const WorldCoordsImage *=NULL) const
 Calculates the displacement vectors for a whole image domain.
 
virtual void Displacement (GenericImage< double > &, double, double, const WorldCoordsImage *=NULL) const
 
virtual void Displacement (GenericImage< float > &, double, double, const WorldCoordsImage *=NULL) const
 
virtual void DisplacementAfterDOFChange (int dof, double dv, GenericImage< double > &dx, double t, double t0=NaN, const WorldCoordsImage *i2w=NULL) const
 
double EvaluateRMSError (const ImageAttributes &, const Transformation *) const
 Evaluates RMS error of transformation compared to another.
 
double EvaluateRMSError (const ImageAttributes &, double *, double *) const
 
double EvaluateRMSError (const ImageAttributes &, double *, double *, double *) const
 
double EvaluateRMSError (const double *, const double *, const double *, double, double *, double *, double *, int no) const
 Evaluates RMS error of transformation compared to displacement field.
 
double EvaluateRMSError (const double *, const double *, const double *, const double *, double *, double *, double *, int no) const
 Evaluates RMS error of transformation compared to given displacement field.
 
virtual double Get (int) const
 Get value of transformation parameter.
 
virtual void Get (DOFValue *) const
 Get values of transformation parameters.
 
virtual DOFStatus GetStatus (int) const
 Get status of transformation parameter.
 
virtual void GlobalDisplacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point using the global transformation component only.
 
virtual void GlobalInverseDisplacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point using the inverse of the global transformation only.
 
virtual double GlobalJacobian (double, double, double, double=0, double=NaN) const
 Calculates the determinant of the Jacobian of the global transformation w.r.t world coordinates.
 
virtual bool HasSameDOFsAs (const Transformation *) const
 Checks whether transformation depends on the same vector of parameters.
 
virtual bool Inverse (Point &, double=0, double=NaN) const
 Transforms a single point using the inverse of the transformation.
 
virtual int Inverse (PointSet &, double=0, double=NaN) const
 
virtual bool InverseDisplacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point using the inverse of the transformation.
 
virtual int InverseDisplacement (const ImageAttributes &, double *, double *, double *) const
 
virtual int InverseDisplacement (GenericImage< double > &, double=NaN, const WorldCoordsImage *=NULL) const
 
virtual int InverseDisplacement (GenericImage< float > &, double=NaN, const WorldCoordsImage *=NULL) const
 
virtual int InverseDisplacement (GenericImage< double > &, double, double, const WorldCoordsImage *=NULL) const
 
virtual int InverseDisplacement (GenericImage< float > &, double, double, const WorldCoordsImage *=NULL) const
 
virtual bool IsIdentity () const
 Checks whether the transformation is an identity mapping.
 
virtual double Jacobian (double, double, double, double=0, double=NaN) const
 Calculates the determinant of the Jacobian of the transformation w.r.t world coordinates.
 
virtual void JacobianDOFs (double [3], int, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the transformation w.r.t a transformation parameter.
 
virtual void LocalDisplacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point using the local transformation component only.
 
virtual void LocalHessian (Matrix [3], double, double, double, double=0, double=NaN) const
 Calculates the Hessian for each component of the local transformation w.r.t world coordinates.
 
virtual bool LocalInverse (double &, double &, double &, double=0, double=NaN) const
 Transforms a single point using the inverse of the local transformation only.
 
virtual bool LocalInverseDisplacement (double &, double &, double &, double=0, double=NaN) const
 Calculates the displacement of a single point using the inverse of the local transformation only.
 
virtual void LocalJacobian (Matrix &, double, double, double, double=0, double=NaN) const
 Calculates the Jacobian of the local transformation w.r.t world coordinates.
 
virtual double LocalJacobian (double, double, double, double=0, double=NaN) const
 Calculates the determinant of the Jacobian of the local transformation w.r.t world coordinates.
 
virtual void LocalTransform (double &, double &, double &, double=0, double=NaN) const =0
 Transforms a single point using the local transformation component only.
 
int NumberOfActiveDOFs () const
 Get number of active transformation parameters.
 
virtual int NumberOfDOFs () const
 Get number of transformation parameters.
 
int NumberOfPassiveDOFs () const
 Get number of passive transformation parameters.
 
void ParametricGradient (const GenericImage< double > *, double *, const WorldCoordsImage *, double=NaN, double=1) const
 
void ParametricGradient (const GenericImage< double > *, double *, double=NaN, double=1) const
 
virtual void ParametricGradient (const GenericImage< double > **, int, double *, const WorldCoordsImage *, const WorldCoordsImage *, const double *=NULL, double=1) const
 
void ParametricGradient (const GenericImage< double > **, int, double *, const WorldCoordsImage *, const double *=NULL, double=1) const
 
void ParametricGradient (const GenericImage< double > **, int, double *, const double *=NULL, double=1) const
 
void Print (Indent=0) const
 Prints information about the transformation.
 
virtual void Put (int, double)
 Put value of transformation parameter.
 
virtual void Put (const DOFValue *)
 Put values of transformation parameters.
 
virtual void PutStatus (int, DOFStatus)
 Put status of transformation parameter.
 
virtual void Read (const char *)
 Reads a transformation from a file.
 
virtual CifstreamRead (Cifstream &)
 Reads a transformation from a file stream.
 
virtual bool RequiresCachingOfDisplacements () const
 
virtual void Reset ()
 Reset transformation.
 
virtual void Transform (Point &, double=0, double=NaN) const
 Transforms a single point.
 
virtual void Transform (PointSet &, double=0, double=NaN) const
 Transforms a set of points.
 
virtual void Transform (int, double *, double *, double *, double=0, double=NaN) const
 Transforms a set of points.
 
virtual void Transform (int, double *, double *, double *, const double *, double=NaN) const
 Transforms a set of points.
 
virtual void Transform (WorldCoordsImage &, double=NaN) const
 Transforms world coordinates of image voxels.
 
virtual TransformationType TypeOfClass () const
 Returns type ID of the instantiated transformation class.
 
virtual double Update (const DOFValue *)
 Update transformation parameters given parametric gradient.
 
virtual void Verify ()
 
virtual void Write (const char *) const
 Writes a transformation to a file.
 
virtual CofstreamWrite (Cofstream &) const
 Writes a transformation to a file stream.
 
virtual ~Transformation ()
 Default destructor.
 
- Public Member Functions inherited from mirtk::Observable
void AddObserver (Observer &)
 Add observer.
 
void Broadcast (Event, const void *=NULL)
 Broadcast event to observers.
 
void ClearObservers ()
 Delete all observers.
 
void DeleteObserver (Observer &)
 Delete observer.
 
void NotifyObservers (Event, const void *=NULL)
 Notify all observers about given event if this object has changed.
 
int NumberOfObservers () const
 Number of current observers.
 
virtual ~Observable ()
 Destructor.
 
- Public Member Functions inherited from mirtk::Object
virtual const char * NameOfClass () const =0
 Get name of class, which this object is an instance of.
 
bool Parameter (const ParameterList &)
 Set parameters from name/value pairs.
 
virtual ~Object ()
 Destructor.
 

Static Public Member Functions

static double Bending3D (const Matrix [3])
 Calculates the bending of the transformation given the 2nd order derivatives.
 
static ImageAttributes DefaultAttributes (const ImageAttributes &attr, double dx=-1.0, double dy=-1.0, double dz=-1.0, double dt=-1.0)
 
static ImageAttributes DefaultAttributes (double, double, double, double, double, double, double, double, double, double, double, double, const double *, const double *, const double *)
 Default attributes of free-form transformation lattice.
 
- Static Public Member Functions inherited from mirtk::Transformation
static bool CheckHeader (const char *)
 Whether magic number in header of given file.
 
static TransformationNew (TransformationType)
 
static TransformationNew (const Transformation *)
 
static TransformationNew (const char *)
 
static TransformationType TypeOfClass (const char *)
 Returns type ID corresponding to transformations of the named class.
 
- Static Public Member Functions inherited from mirtk::Object
static const char * NameOfType ()
 Get name of this class type.
 

Protected Member Functions

 FreeFormTransformation (CPInterpolator &, CPInterpolator *=NULL)
 Default constructor.
 
 FreeFormTransformation (const FreeFormTransformation &, CPInterpolator &, CPInterpolator *=NULL)
 Copy constructor.
 
void InitializeCPs (const ImageAttributes &, bool=true)
 Initialize control points.
 
void InitializeCPs (const FreeFormTransformation &, bool=true)
 Copy control points from other transformation.
 
void InitializeInterpolator ()
 Initialize interpolator of control points.
 
void InitializeStatus ()
 Initialize status of control points.
 
CofstreamWriteCPs (Cofstream &) const
 Writes the control point and status information to a file stream.
 
- Protected Member Functions inherited from mirtk::Transformation
void InitializeDOFs (int)
 Initialize transformation parameters.
 
void InitializeDOFs (const Transformation &, int=-1)
 Copy transformation parameters (DoFs) and their status.
 
virtual CifstreamReadDOFs (Cifstream &, TransformationType)
 Reads transformation parameters from a file stream.
 
 Transformation (int=0)
 Default constructor.
 
 Transformation (const Transformation &)
 Copy constructor.
 
 Transformation (const Transformation &, int)
 Copy constructor.
 
virtual CofstreamWriteDOFs (Cofstream &) const
 Writes transformation parameters to a file stream.
 
- Protected Member Functions inherited from mirtk::Observable
 Observable ()
 Default constructor.
 
 Observable (const Observable &)
 Copy constructor.
 
Observableoperator= (const Observable &)
 Assignment operator.
 
- Protected Member Functions inherited from mirtk::Object
template<typename... Args>
void Throw (ErrorType err, const char *func, Args... args) const
 

Protected Attributes

const ImageAttributes_attr
 Control point lattice attributes.
 
CPInterpolator_CPFunc
 
CPImage _CPImage
 
CPStatus **** _CPStatus
 
CPExtrapolator_CPValue
 Infinite discrete representation of free-form transformation coefficients.
 
const double & _dt
 Read-only reference to _dt attribute of _CPImage.
 
const double & _dx
 Read-only reference to _dx attribute of _CPImage.
 
const double & _dy
 Read-only reference to _dy attribute of _CPImage.
 
const double & _dz
 Read-only reference to _dz attribute of _CPImage.
 
const Matrix_matL2W
 Read-only reference to _matI2W of _CPImage.
 
const Matrix_matW2L
 Read-only reference to _matW2I of _CPImage.
 
const int & _t
 Read-only reference to _t attribute of _CPImage.
 
const int & _x
 Read-only reference to _x attribute of _CPImage.
 
const int & _y
 Read-only reference to _y attribute of _CPImage.
 
const int & _z
 Read-only reference to _z attribute of _CPImage.
 
- Protected Attributes inherited from mirtk::Transformation
int _NumberOfDOFs
 Number of transformation parameters.
 
DOFValue_Param
 Value of each transformation parameter.
 
DOFStatus_Status
 Status of each transformation parameter (Active or Passive)
 

Additional Inherited Members

- Static Protected Member Functions inherited from mirtk::Object
template<typename... Args>
static void ThrowStatic (ErrorType err, const char *cls, const char *func, Args... args)
 

Detailed Description

Base class for free-form transformations.

Definition at line 41 of file FreeFormTransformation.h.

Member Typedef Documentation

§ CPInterpolator

Base type used for interpolation of control point data

Note
Subclasses may use a particular specialized interpolation type.

Definition at line 83 of file FreeFormTransformation.h.

§ Vector

Alias for CPValue type which is preferred when referring to any FFD vector, not only those at control point locations

Definition at line 90 of file FreeFormTransformation.h.

Member Function Documentation

§ ActualNumberOfDOFs()

int mirtk::FreeFormTransformation::ActualNumberOfDOFs ( ) const
inline

Actual number of DoFs, i.e., 2 * NumberOfDOFs for 2D FFD or 3 * NumberOfDOFs for 3D(+t) FFD

Definition at line 830 of file FreeFormTransformation.h.

§ Approximate() [1/4]

virtual double mirtk::FreeFormTransformation::Approximate ( const Transformation ,
int  = 1,
double  = .0 
)
virtual

Approximate transformation: This function takes a transformation and finds a FFD which approximates this transformation at the control point locations. Returns the approximation error of the resulting FFD at the control point locations.

§ Approximate() [2/4]

virtual double mirtk::FreeFormTransformation::Approximate ( const ImageAttributes ,
double *  ,
double *  ,
double *  ,
int  = 1,
double  = .0 
)
virtual

Approximate displacements: This function takes a set of points and a set of displacements and finds a transformation which approximates these displacements. After approximation, the displacements are replaced by the residual displacement errors at the points.

Reimplemented from mirtk::Transformation.

§ Approximate() [3/4]

virtual double mirtk::FreeFormTransformation::Approximate ( const double *  ,
const double *  ,
const double *  ,
double *  ,
double *  ,
double *  ,
int  ,
int  = 1,
double  = .0 
)
virtual

Approximate displacements: This function takes a set of points and a set of displacements and finds a transformation which approximates these displacements. After approximation, the displacements are replaced by the residual displacement errors at the points.

Reimplemented from mirtk::Transformation.

§ Approximate() [4/4]

virtual double mirtk::FreeFormTransformation::Approximate ( const double *  ,
const double *  ,
const double *  ,
const double *  ,
double *  ,
double *  ,
double *  ,
int  ,
int  = 1,
double  = .0 
)
virtual

Approximate displacements: This function takes a set of points and a set of displacements and finds a transformation which approximates these displacements. After approximation, the displacements are replaced by the residual displacement errors at the points.

Reimplemented from mirtk::Transformation.

§ ApproximateAsNew()

virtual double mirtk::FreeFormTransformation::ApproximateAsNew ( const ImageAttributes ,
double *  ,
double *  ,
double *  ,
int  = 1,
double  = .0 
)
virtual

Approximate displacements: This function takes a set of points and a set of displacements and finds a !new! transformation which approximates these displacements. After approximation, the displacements are replaced by the residual displacement errors at the points.

Reimplemented from mirtk::Transformation.

§ ApproximationDomain()

virtual ImageAttributes mirtk::FreeFormTransformation::ApproximationDomain ( const ImageAttributes ,
const Transformation  
)
virtual

Get image domain on which this free-form transformation should be defined in order to reduce the error when the given transformation is approximated and the resulting free-form transformation is applied to resample an image that is defined on the specified lattice.

Reimplemented in mirtk::BSplineFreeFormTransformationSV.

§ BendingEnergyGradient()

virtual void mirtk::FreeFormTransformation::BendingEnergyGradient ( double *  ,
double  = 1.0,
bool  = false,
bool  = true,
bool  = true 
) const
virtual

Approximates the gradient of the bending energy on the control point lattice w.r.t the transformation parameters and adds it with the given weight

Reimplemented in mirtk::BSplineFreeFormTransformation3D, mirtk::BSplineFreeFormTransformation4D, mirtk::LinearFreeFormTransformation4D, mirtk::LinearFreeFormTransformation3D, and mirtk::BSplineFreeFormTransformationStatistical.

§ BoundingBox() [1/8]

void mirtk::FreeFormTransformation::BoundingBox ( int  ,
double &  t1,
double &  t2,
double  = 1 
) const
inlinevirtual

Gets the temporal bounding box for a control point. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Reimplemented in mirtk::BSplineFreeFormTransformation4D, and mirtk::LinearFreeFormTransformation4D.

Definition at line 1209 of file FreeFormTransformation.h.

§ BoundingBox() [2/8]

void mirtk::FreeFormTransformation::BoundingBox ( int  ,
double &  x1,
double &  y1,
double &  z1,
double &  x2,
double &  y2,
double &  z2,
double  = 1 
) const
inlinepure virtual

Gets the spatial bounding box for a control point. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Implemented in mirtk::BSplineFreeFormTransformation3D, mirtk::BSplineFreeFormTransformation4D, mirtk::LinearFreeFormTransformation4D, and mirtk::LinearFreeFormTransformation3D.

Definition at line 1217 of file FreeFormTransformation.h.

§ BoundingBox() [3/8]

void mirtk::FreeFormTransformation::BoundingBox ( int  cp,
double &  x1,
double &  y1,
double &  z1,
double &  t1,
double &  x2,
double &  y2,
double &  z2,
double &  t2,
double  fraction = 1 
) const
inlinevirtual

Gets the spatio-temporal bounding box for a control point. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Reimplemented in mirtk::BSplineFreeFormTransformation4D, and mirtk::LinearFreeFormTransformation4D.

Definition at line 1230 of file FreeFormTransformation.h.

§ BoundingBox() [4/8]

void mirtk::FreeFormTransformation::BoundingBox ( int  cp,
Point p1,
Point p2,
double  fraction = 1 
) const
inline

Gets the spatial bounding box for a control point. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1239 of file FreeFormTransformation.h.

§ BoundingBox() [5/8]

bool mirtk::FreeFormTransformation::BoundingBox ( const ImageAttributes domain,
int  cp,
int &  i1,
int &  j1,
int &  k1,
int &  i2,
int &  j2,
int &  k2,
double  fraction = 1 
) const
inline

Gets the spatial bounding box for a control point in lattice coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1245 of file FreeFormTransformation.h.

§ BoundingBox() [6/8]

bool mirtk::FreeFormTransformation::BoundingBox ( const ImageAttributes domain,
int  cp,
int &  i1,
int &  j1,
int &  k1,
int &  l1,
int &  i2,
int &  j2,
int &  k2,
int &  l2,
double  fraction = 1 
) const
inline

Gets the spatio-temporal bounding box for a control point in lattice coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1305 of file FreeFormTransformation.h.

§ BoundingBox() [7/8]

bool mirtk::FreeFormTransformation::BoundingBox ( const Image image,
int  cp,
int &  i1,
int &  j1,
int &  k1,
int &  i2,
int &  j2,
int &  k2,
double  fraction = 1 
) const
inline

Gets the spatial bounding box for a control point in image coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1296 of file FreeFormTransformation.h.

§ BoundingBox() [8/8]

bool mirtk::FreeFormTransformation::BoundingBox ( const Image image,
int  cp,
int &  i1,
int &  j1,
int &  k1,
int &  l1,
int &  i2,
int &  j2,
int &  k2,
int &  l2,
double  fraction = 1 
) const
inline

Gets the spatio-temporal bounding box for a control point in image coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1336 of file FreeFormTransformation.h.

§ CopyFrom()

bool mirtk::FreeFormTransformation::CopyFrom ( const Transformation other)
inlinevirtual

Copy active transformation parameters (DoFs) from given transformation if possible and return false, otherwise

Reimplemented from mirtk::Transformation.

Definition at line 1381 of file FreeFormTransformation.h.

§ CropPadPassiveCPs() [1/2]

bool mirtk::FreeFormTransformation::CropPadPassiveCPs ( int  = 0,
bool  = false 
)

Crop/pad lattice to discard passive control points at the boundary, keeping only a layer of passive control points of given width. The DoF values of passive control points are optionally reset to zero.

§ CropPadPassiveCPs() [2/2]

virtual bool mirtk::FreeFormTransformation::CropPadPassiveCPs ( int  ,
int  ,
int  = 0,
int  = 0,
bool  = false 
)
virtual

Crop/pad lattice to discard passive control points at the boundary, keeping only a layer of passive control points of given width. The DoF values of passive control points are optionally reset to zero.

Reimplemented in mirtk::BSplineFreeFormTransformationStatistical.

§ DefaultAttributes()

static ImageAttributes mirtk::FreeFormTransformation::DefaultAttributes ( const ImageAttributes attr,
double  dx = -1.0,
double  dy = -1.0,
double  dz = -1.0,
double  dt = -1.0 
)
static

Default attributes of free-form transformation lattice

Parameters
[in]attr(Target) image attributes.
[in]dxControl point spacing in x.
[in]dyControl point spacing in y.
[in]dzControl point spacing in z.
[in]dtControl point spacing in t.
Note
If a control point number/spacing is negative, it is set to the specified number/size.

§ DOFBoundingBox() [1/2]

bool mirtk::FreeFormTransformation::DOFBoundingBox ( const ImageAttributes domain,
int  dof,
int &  i1,
int &  j1,
int &  k1,
int &  i2,
int &  j2,
int &  k2,
double  fraction = 1 
) const
inline

Gets the spatial bounding box for a transformation parameter in lattice coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Definition at line 1345 of file FreeFormTransformation.h.

§ DOFBoundingBox() [2/2]

bool mirtk::FreeFormTransformation::DOFBoundingBox ( const Image image,
int  dof,
int &  i1,
int &  j1,
int &  k1,
int &  i2,
int &  j2,
int &  k2,
double  fraction = 1 
) const
inlinevirtual

Gets the spatial bounding box for a transformation parameter in image coordinates. The last parameter specifies what fraction of the bounding box to return. The default is 1 which equals 100% of the bounding box.

Reimplemented from mirtk::Transformation.

Definition at line 1354 of file FreeFormTransformation.h.

§ Extrapolator()

const FreeFormTransformation::CPExtrapolator * mirtk::FreeFormTransformation::Extrapolator ( ) const
inline

Get access to control point coefficients extrapolator Intended for use by non-member auxiliary functions of subclass implementations.

Definition at line 786 of file FreeFormTransformation.h.

§ FFDJacobianDetDerivative()

virtual void mirtk::FreeFormTransformation::FFDJacobianDetDerivative ( double  dJ[3],
const Matrix adj,
int  cp,
double  x,
double  y,
double  z,
double  = 0,
double  = NaN,
bool  wrt_world = true,
bool  use_spacing = true 
) const
virtual

Calculates derivatives of the Jacobian determinant of spline function w.r.t. DoFs of a control point

This function is identical to JacobianDetDerivative when the DoFs of the control points are displacements. When the DoFs are velocities, however, this function computes the derivatives of the Jacobian determinant of the velocity field instead.

Parameters
[out]dJPartial derivatives of Jacobian determinant at (x, y, z) w.r.t. DoFs of control point.
[in]cpIndex of control point w.r.t. whose DoFs the derivatives are computed.
[in]xWorld coordinate along x axis at which to evaluate derivatives.
[in]yWorld coordinate along y axis at which to evaluate derivatives.
[in]zWorld coordinate along z axis at which to evaluate derivatives.
[in]adjAdjugate of Jacobian matrix evaluated at (x, y, z).
[in]wrt_worldWhether derivatives are computed w.r.t. world coordinate system.
[in]use_spacingWhether to use grid spacing when wrt_world is true.

Reimplemented in mirtk::BSplineFreeFormTransformation3D.

§ HessianToWorld() [1/4]

void mirtk::FreeFormTransformation::HessianToWorld ( double &  duu,
double &  duv,
double &  dvv 
) const
inline

Convert 2nd order derivatives computed w.r.t 2D lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1590 of file FreeFormTransformation.h.

§ HessianToWorld() [2/4]

void mirtk::FreeFormTransformation::HessianToWorld ( double &  duu,
double &  duv,
double &  duw,
double &  dvv,
double &  dvw,
double &  dww 
) const
inline

Convert 2nd order derivatives computed w.r.t 3D lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1614 of file FreeFormTransformation.h.

§ HessianToWorld() [3/4]

void mirtk::FreeFormTransformation::HessianToWorld ( Matrix hessian) const
inline

Convert 2nd order derivatives of single transformed coordinate computed w.r.t lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1652 of file FreeFormTransformation.h.

§ HessianToWorld() [4/4]

void mirtk::FreeFormTransformation::HessianToWorld ( Matrix  hessian[3]) const
inline

Convert 2nd order derivatives computed w.r.t lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1668 of file FreeFormTransformation.h.

§ Interpolate()

virtual void mirtk::FreeFormTransformation::Interpolate ( const double *  ,
const double *  ,
const double *   
)
pure virtual

§ JacobianDetDerivative()

void mirtk::FreeFormTransformation::JacobianDetDerivative ( double  dJ[3],
const Matrix adj,
int  cp,
double  x,
double  y,
double  z,
double  t = 0,
double  t0 = NaN,
bool  wrt_world = true,
bool  use_spacing = true 
) const
inlinevirtual

Calculates derivatives of the Jacobian determinant at world point w.r.t. DoFs of a control point

Parameters
[out]dJPartial derivatives of Jacobian determinant w.r.t. DoFs of control point.
[in]adjPre-computed adjugate of Jacobian matrix at this world point.
[in]cpIndex of control point w.r.t. whose DoFs the derivatives are computed.
[in]xWorld coordinate along x axis at which to evaluate derivatives.
[in]yWorld coordinate along y axis at which to evaluate derivatives.
[in]zWorld coordinate along z axis at which to evaluate derivatives.
[in]tTemporal coordinate of point at which to evaluate derivatives.
[in]t0Temporal coordinate of co-domain (target). Used by velocity-based models.
[in]wrt_worldWhether derivatives are computed w.r.t. world coordinate system.
[in]use_spacingWhether to use grid spacing when wrt_world is true.

Reimplemented in mirtk::BSplineFreeFormTransformationSV.

Definition at line 1789 of file FreeFormTransformation.h.

§ JacobianToWorld() [1/3]

void mirtk::FreeFormTransformation::JacobianToWorld ( double &  du,
double &  dv 
) const
inline

Convert 1st order derivatives computed w.r.t 2D lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1542 of file FreeFormTransformation.h.

§ JacobianToWorld() [2/3]

void mirtk::FreeFormTransformation::JacobianToWorld ( double &  du,
double &  dv,
double &  dw 
) const
inline

Convert 1st order derivatives computed w.r.t 3D lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1550 of file FreeFormTransformation.h.

§ JacobianToWorld() [3/3]

void mirtk::FreeFormTransformation::JacobianToWorld ( Matrix jac) const
inline

Convert 1st order derivatives computed w.r.t lattice coordinates to derivatives w.r.t world coordinates

Definition at line 1559 of file FreeFormTransformation.h.

§ ParametricGradient() [1/2]

virtual void mirtk::FreeFormTransformation::ParametricGradient ( const GenericImage< double > *  ,
double *  ,
const WorldCoordsImage ,
const WorldCoordsImage ,
double  = NaN,
double  = 1 
) const
virtual

Applies the chain rule to convert spatial non-parametric gradient to a gradient w.r.t the parameters of this transformation.

If the transformation itself is non-parametric, the gradient will be passed through unchanged. The default implementation uses the full Jacobian matrix computed for each DoF separately (i.e., calls JacobianDOFs for each DoF).

For 4D transformations, the temporal coordinate t used for the computation of the Jacobian of the transformation w.r.t the transformation parameters for all spatial (x, y, z) voxel coordinates in world units, is assumed to correspond to the temporal origin of the given gradient image. For 4D transformations parameterized by velocities, a second time for the upper integration bound can be provided as last argument to this method. This last argument is ignored by transformations parameterized by displacements.

See also
ImageSimilarityMetric::EvaluateGradient

Reimplemented from mirtk::Transformation.

Reimplemented in mirtk::BSplineFreeFormTransformationSV, mirtk::BSplineFreeFormTransformation3D, mirtk::BSplineFreeFormTransformation4D, mirtk::BSplineFreeFormTransformationTD, mirtk::BSplineFreeFormTransformationStatistical, mirtk::FreeFormTransformation3D, and mirtk::FreeFormTransformation4D.

§ ParametricGradient() [2/2]

virtual void mirtk::FreeFormTransformation::ParametricGradient ( const PointSet ,
const Vector3D< double > *  ,
double *  ,
double  = 0,
double  = NaN,
double  = 1 
) const
virtual

Applies the chain rule to convert point-wise non-parametric gradient to a gradient w.r.t the parameters of this transformation.

Reimplemented from mirtk::Transformation.

Reimplemented in mirtk::BSplineFreeFormTransformationSV, mirtk::BSplineFreeFormTransformationTD, and mirtk::FreeFormTransformation3D.

Member Data Documentation

§ _CPFunc

CPInterpolator* mirtk::FreeFormTransformation::_CPFunc
protected

Infinite continuous function of free-form transformation

Note that the actual interpolator object is (at the moment) attribute of the specific FFD implementation. The base class pointer here is only used to update the interpolator when necessary, e.g., when the extrapolation mode has changed. It is set by the base class constructor to the respective interpolate image function attribute of the subclass.

Definition at line 131 of file FreeFormTransformation.h.

§ _CPImage

CPImage mirtk::FreeFormTransformation::_CPImage
protected

Finite discrete representation of free-form transformation coefficients

Note that this image instance stores all the attributes of the control point lattice. The actual control point data is stored in the parameters of the transformation, the memory of which is managed by the base class. The image only wraps this memory and interprets it as an image. This allows the use of image functions such as interpolators and efficient image filters.

Definition at line 119 of file FreeFormTransformation.h.

§ _CPStatus

CPStatus**** mirtk::FreeFormTransformation::_CPStatus
protected

Status of control points

Note that the actual status values are stored by the base class member Transformation::_Status in a contiguous memory block.

Definition at line 138 of file FreeFormTransformation.h.


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