#include <DeformableSurfaceModel.h>
Public Member Functions | |
void | Add (class ExternalForce *, bool=true) |
Add external force term and take over ownership of the object. | |
void | Add (class InternalForce *, bool=true) |
Add internal force term and take over ownership of the object. | |
void | Add (TransformationConstraint *, bool=true) |
Add transformation regularization term and take over ownership of the object. | |
void | Clear () |
Delete previously added energy terms. | |
DeformableSurfaceModel () | |
Constructor. | |
bool | Empty () const |
Whether energy function has no terms. | |
virtual double | Evaluate (double *dx=NULL, double step=.0, bool *sgn_chg=NULL) |
class ExternalForce * | ExternalForce (int) |
Get the n-th external force term. | |
const class ExternalForce * | ExternalForce (int) const |
Get the n-th external force term. | |
virtual void | Get (double *x) const |
virtual double | Get (int) const |
void | Gradient (double *dx, double step=.0, bool *sgn_chg=NULL) |
double | GradientNorm (const double *) const |
void | GradientStep (const double *dx, double &min, double &max) const |
virtual void | Initialize () |
Initialize energy terms once input and parameters have been set. | |
double | InitialValue () |
Query/evaluate initial value of energy function. | |
double | InitialValue (int) |
Get initial value of n-th energy term. | |
class InternalForce * | InternalForce (int) |
Get the n-th internal force term. | |
const class InternalForce * | InternalForce (int) const |
Get the n-th internal force term. | |
bool | IsExternalForce (int) const |
Determine whether n-th energy term is an external force. | |
bool | IsImplicitSurfaceForce (int) const |
Determine whether n-th energy term is an external implicit surface force. | |
bool | IsInternalForce (int) const |
Determine whether n-th energy term is an internal force. | |
virtual int | NumberOfDOFs () const |
Get number of deformable surface parameters. | |
int | NumberOfExternalForces () const |
Number of external force terms. | |
int | NumberOfForces () const |
Number of energy terms. | |
int | NumberOfInternalForces () const |
Number of internal force terms. | |
int | NumberOfPoints () const |
Get number of deformable surface points. | |
vtkSmartPointer< vtkPointSet > | Output () const |
Output surface mesh. | |
virtual ParameterList | Parameter () const |
Get parameter as key/value as string map. | |
virtual void | Put (const double *x) |
double | RawValue (int) |
virtual bool | Remesh () |
virtual bool | Set (const char *, const char *) |
Set parameter value from string. | |
virtual double | Step (double *dx) |
void | Sub (class ExternalForce *) |
Remove external force term and revoke ownership of the object. | |
void | Sub (class InternalForce *) |
Remove internal force term and revoke ownership of the object. | |
void | Sub (TransformationConstraint *) |
Remove transformation regularization term and revoke ownership of the object. | |
EnergyTerm * | Term (int) |
Get the n-th energy term. | |
const EnergyTerm * | Term (int) const |
Get the n-th energy term. | |
virtual void | Update (bool=true) |
Update internal state after change of parameters. | |
virtual bool | Upgrade () |
double | Value () |
Evaluate energy function. | |
double | Value (int) |
Get value of n-th energy term computed upon last evaluation. | |
virtual void | WriteDataSets (const char *, const char *, bool=true) const |
Write input of data force terms. | |
virtual void | WriteGradient (const char *, const char *) const |
Write gradient of force terms. | |
virtual | ~DeformableSurfaceModel () |
Destructor. | |
Public Member Functions inherited from mirtk::ObjectiveFunction | |
virtual void | AddConstraintGradient (double *dx, double step=.0, bool *sgn_chg=nullptr) |
virtual void | DataFidelityGradient (double *dx, double step=.0, bool *sgn_chg=nullptr) |
virtual | ~ObjectiveFunction ()=0 |
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 bool | IsExternalForce (const EnergyTerm *) |
Determine whether a given force term is an external force. | |
static bool | IsImplicitSurfaceForce (const EnergyTerm *) |
Determine whether a given force term is an external implicit surface force. | |
static bool | IsInternalForce (const EnergyTerm *) |
Determine whether a given force term is an internal force. | |
Static Public Member Functions inherited from mirtk::Object | |
static const char * | NameOfType () |
Get name of this class type. | |
Protected Member Functions | |
virtual void | EnforceHardConstraints (double *dx) const |
void | ResolveSurfaceCollisions (double *dx, bool nsi, double mind, double minw) const |
virtual void | SmoothGradient (double *dx) const |
Smooth gradient such that neighboring points move coherently. | |
Protected Member Functions inherited from mirtk::ObjectiveFunction | |
mirtkAttributeMacro (double, StepLength) | |
Default step length used for gradient approximation. | |
Protected Member Functions inherited from mirtk::Observable | |
Observable () | |
Default constructor. | |
Observable (const Observable &) | |
Copy constructor. | |
Observable & | operator= (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 | |
Array< vtkSmartPointer< vtkPolyData > > | _BoundaryConstraint |
Input surface meshes which the deformed surface mesh may not intersect. | |
Array< TransformationConstraint * > | _Constraint |
Energy terms which regularize the parametric transformation. | |
Array< class ExternalForce * > | _ExternalForce |
Energy terms corresponding to external forces. | |
Array< class InternalForce * > | _InternalForce |
Energy terms corresponding to internal forces. | |
int | _LowPassCounter |
Number of iterations since last low-pass filtering. | |
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) |
Energy function describing a deformable surface model
Definition at line 48 of file DeformableSurfaceModel.h.
|
protectedvirtual |
Enforce hard constraints on surface model deformation
This function clamps a nodes' displacement vector (velocity times \(\delta t\)), if otherwise the hard constraints of the deformable surface model would be violated. Common hard constraints are non-self-intersection and a maximum total node displacement. If the surface model is deformed by a parametric transformation, this function does nothing as hard constraints can only be enforced during the optimization when the parameters of the deformable surface model are the positions of the individual surface nodes.
[in,out] | dx | (Scaled) gradient of objective function. |
|
virtual |
Evaluate energy function
This function first updates the internal state of the function object if required due to a previous change of the function parameters and then evaluates the current energy function value.
[in] | step | Step length for finite differences. |
[out] | dx | Gradient of objective function. If NULL , only the function value is computed. |
[out] | sgn_chg | Whether function parameter value is allowed to change sign when stepping along the computed gradient. Ignord if dx is NULL . |
Reimplemented from mirtk::ObjectiveFunction.
|
virtual |
Get deformable surface parameters
This function can be used to store a backup of the current deformable surface parameters before an update such that these can be restored using the Put member function if the update did not result in the desired change of the overall energy.
[in] | x | Current values of deformable surface parameters (DoFs). |
Implements mirtk::ObjectiveFunction.
|
virtual |
Get function parameter value
Implements mirtk::ObjectiveFunction.
|
virtual |
Evaluate gradient of energy function
This gradient corresponds to the weighted sum of external and internal forces of the deformable surface model.
[in] | dx | Gradient of energy function. |
[in] | step | Step length for finite differences. |
[out] | sgn_chg | Whether function parameter value is allowed to change sign when stepping along the computed gradient. |
Implements mirtk::ObjectiveFunction.
|
virtual |
Compute norm of gradient of energy function
This norm can, for example, be the maximum absolute parameter change, the maximum control point displacement if a FFD transformation is used to deform the initial surface mesh, or the maximum vertex displacement.
Implements mirtk::ObjectiveFunction.
|
virtual |
Adjust step length range
[in] | dx | Gradient of objective function. |
[in,out] | min | Minimum step length. |
[in,out] | max | Maximum step length. |
Reimplemented from mirtk::ObjectiveFunction.
|
virtual |
Set deformable surface parameters
This function can be used to restore the deformable surface parameters after a failed update which did not result in the desired improvement.
[in] | x | Value of deformable surface parameters (DoFs). |
Implements mirtk::ObjectiveFunction.
double mirtk::DeformableSurfaceModel::RawValue | ( | int | ) |
Get unweighted and unnormalized value of n-th energy term
|
virtual |
Perform local adaptive remeshing
|
protected |
Adjust node displacements to avoid self-intersections and collisions
[in,out] | dx | (Scaled) gradient of objective function. |
[in] | nsi | Enforce non-self-intersection. |
[in] | mind | Minimum front-facing distance. |
[in] | minw | Minimum back-facing distance. |
|
virtual |
Add change (i.e., scaled gradient) to each deformable surface parameter
This function updates each parameter of the deformable surface model given a vector of desired changes, i.e., the computed gradient of the energy function.
[in,out] | dx | Change of each function parameter (DoF) as computed by the Gradient member function and scaled by a chosen step length. The change of a parameter may be modified by this function in order to satisfy the hard constraints (if any). |
Implements mirtk::ObjectiveFunction.
|
virtual |
Update energy function after convergence
For example, fiducial registration error (FRE) terms may update the point correspondences before another gradient-based optimization of the new FRE term.
Reimplemented from mirtk::ObjectiveFunction.