Public Types | Public Member Functions | Protected Member Functions | List of all members
mirtk::PointSetForce Class Reference

#include <PointSetForce.h>

Inheritance diagram for mirtk::PointSetForce:
Inheritance graph
Collaboration diagram for mirtk::PointSetForce:
Collaboration graph

Public Types

typedef RegisteredPointSet::EdgeTable EdgeTable
 Adjacency matrix with edge IDs.
 
typedef Vector3D< double > GradientType
 Type of gradient w.r.t a single transformed data point.
 
typedef RegisteredPointSet::NodeNeighbors NodeNeighbors
 Table of n-connected node neighbors.
 
- Public Types inherited from mirtk::EnergyTerm
typedef ObjectFactory< enum EnergyMeasure, EnergyTermFactoryType
 Type of energy term factory.
 

Public Member Functions

virtual void Initialize ()
 Initialize force term once input and parameters have been set.
 
virtual void Reinitialize ()
 
virtual void Update (bool=true)
 Update moving input points and internal state of force term.
 
virtual void WriteDataSets (const char *, const char *, bool=true) const
 Write input of force term.
 
virtual void WriteGradient (const char *, const char *) const
 Write gradient of force term.
 
virtual ~PointSetForce ()
 Destructor.
 
- Public Member Functions inherited from mirtk::EnergyTerm
virtual enum EnergyMeasure EnergyMeasure () const =0
 Energy measure implemented by this term.
 
void Gradient (double *gradient, double step)
 
virtual void GradientStep (const double *gradient, double &min, double &max) const
 
double InitialValue ()
 Returns initial value of energy term.
 
void NormalizedGradient (double *gradient, double step)
 
virtual ParameterList Parameter () const
 Get parameter key/value as string map.
 
string Prefix (const char *=NULL) const
 Prefix to be used for debug output files.
 
virtual void Print (Indent=0) const
 Print debug information.
 
virtual double RawValue (double) const
 
double RawValue ()
 
void ResetInitialValue ()
 Reset initial value of energy term.
 
void ResetValue ()
 Reset cached value of energy term.
 
virtual bool Upgrade ()
 Update energy term after convergence.
 
double Value ()
 Evaluate energy term.
 
virtual ~EnergyTerm ()
 Destructor.
 
- Public Member Functions inherited from mirtk::Configurable
string DefaultName () const
 
virtual bool Set (const char *, const char *)
 Set parameter value from string.
 
virtual ~Configurable ()
 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.
 

Protected Member Functions

void AddPointData (const char *name, vtkSmartPointer< vtkDataArray > &data, bool global=false)
 
vtkDataArray * AddPointData (const char *name, int c=1, int type=VTK_FLOAT, bool global=false)
 
void AllocateCount (int)
 Allocate _Count memory.
 
void AllocateGradient (int)
 Allocate memory for (non-parametric) gradient.
 
void CopyAttributes (const PointSetForce &)
 Copy attributes of this class from another instance.
 
vtkPointSet * DeformedPointSet () const
 Get point set on which this force is acting on.
 
vtkPolyData * DeformedSurface () const
 Get point set on which this force is acting on.
 
const EdgeTableEdges () const
 Get edge table of point set mesh.
 
virtual void EvaluateGradient (double *gradient, double step, double weight)
 
vtkSmartPointer< vtkPoints > GetInitialPoints () const
 Get initial points, possibly pre-transformed by global transformation.
 
void Init ()
 Common (re-)initialization steps of this class only (non-virtual function!)
 
vtkDataArray * InitialStatus () const
 Get initial point status array.
 
 mirtkAggregateMacro (int, Count)
 
 mirtkAttributeMacro (int, GradientSize)
 Size of gradient vector.
 
 mirtkAttributeMacro (int, CountSize)
 Size of count vector.
 
 mirtkAttributeMacro (bool, InitialUpdate)
 Whether Update has not been called since initialization.
 
 mirtkComponentMacro (GradientType, Gradient)
 Negative node forces/gradient of external force term.
 
 mirtkPublicAggregateMacro (RegisteredPointSet, PointSet)
 Transformed point set.
 
 mirtkPublicAttributeMacro (int, GradientAveraging)
 Number of gradient averaging iterations.
 
 mirtkPublicAttributeMacro (bool, AverageSignedGradients)
 
 mirtkPublicAttributeMacro (bool, AverageGradientMagnitude)
 Whether to only average the magnitude of the gradient vectors.
 
 mirtkReadOnlyAttributeMacro (bool, SurfaceForce)
 
 mirtkReadOnlyAttributeMacro (int, NumberOfPoints)
 Number of points.
 
const NodeNeighborsNeighbors (int=-1) const
 Get edge-connectivity table of point set node neighbors.
 
vtkDataArray * Normals () const
 Get point normals array.
 
PointSetForceoperator= (const PointSetForce &)
 Assignment operator.
 
vtkPointSet * OriginalPointSet () const
 Get point set on which this force is acting on.
 
vtkPolyData * OriginalSurface () const
 Get point set on which this force is acting on.
 
vtkPointData * PointData () const
 Get point data.
 
vtkDataArray * PointData (const char *name, bool optional=false) const
 
vtkPoints * Points () const
 Get points of point set on which this force is acting on.
 
 PointSetForce (const char *="", double=1.0)
 Constructor.
 
 PointSetForce (const PointSetForce &)
 Copy constructor.
 
void RemovePointData (const char *name)
 
SharedPtr< const EdgeTableSharedEdgeTable () const
 Get edge table of point set mesh.
 
vtkDataArray * Status () const
 Get point status array.
 
- Protected Member Functions inherited from mirtk::EnergyTerm
 EnergyTerm (const char *="", double=1.0)
 Constructor.
 
 EnergyTerm (const EnergyTerm &)
 Copy constructor.
 
virtual double Evaluate ()=0
 Evaluate unweighted energy term.
 
EnergyTermoperator= (const EnergyTerm &)
 Assignment operator.
 
virtual bool SetWithoutPrefix (const char *, const char *)
 Set parameter value from string.
 
virtual bool SetWithPrefix (const char *, const char *)
 Set parameter value from string.
 
- Protected Member Functions inherited from mirtk::Configurable
 Configurable (const char *="")
 Constructor.
 
 Configurable (const Configurable &)
 Copy constructor.
 
string DefaultPrefix () const
 Get default object name prefix (if any)
 
bool HasName () const
 Whether this object has an explicit name.
 
bool HasPrefix () const
 Whether this object has either an explicit name or default prefix.
 
template<class T >
bool InsertWithPrefix (ParameterList &, string, T) const
 Insert parameter into name/value list with object name prefix.
 
bool InsertWithPrefix (ParameterList &, const ParameterList &) const
 Insert parameters into name/value list with object name prefix.
 
Configurableoperator= (const Configurable &)
 Assignment operator.
 
string ParameterNameWithoutPrefix (const char *) const
 Get name of parameter without object name prefix.
 
string ParameterNameWithPrefix (const string &) const
 Get name of parameter with default object name prefix.
 
string ParameterNameWithPrefix (const char *) const
 Get name of parameter with default object name prefix.
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from mirtk::EnergyTerm
static FactoryTypeFactory ()
 Get global energy term factory instance.
 
static EnergyTermNew (EnergyMeasure, const char *="", double=1.0)
 Construct new energy term.
 
static EnergyTermTryNew (EnergyMeasure, const char *="", double=1.0)
 Construct new energy term or return nullptr if term not available.
 
- Static Public Member Functions inherited from mirtk::Object
static const char * NameOfType ()
 Get name of this class type.
 
- 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 point set force terms

Subclasses implement in particular internal and external forces for deformable surface models. Internal force terms may further be used to regularize the deformation of a surface during image/point set registration.

Definition at line 45 of file PointSetForce.h.

Member Function Documentation

§ AddPointData() [1/2]

void mirtk::PointSetForce::AddPointData ( const char *  name,
vtkSmartPointer< vtkDataArray > &  data,
bool  global = false 
)
protected

Add given array to point data attributes of deformed point set

This function should be used by subclasses to add point data arrays to the point set (or its surface, respectively, if _SurfaceForce is true). The added point data is interpolated at new node positions whenever the deformed point set is being remeshed during the optimization.

Parameters
[in]nameName of array. The actual name of the point data array will be made unique by this function which stores an internal map from the given name to the unique array name.
[in]dataPoint data array.
[in]globalWhether point data array is shared among point forces. If true, the array name is used unmodified such that other force terms can reuse the array.

§ AddPointData() [2/2]

vtkDataArray* mirtk::PointSetForce::AddPointData ( const char *  name,
int  c = 1,
int  type = VTK_FLOAT,
bool  global = false 
)
protected

Add new point data array of given type with specified number of components

This function should be used by subclasses to add point data arrays to the point set (or its surface, respectively, if _SurfaceForce is true). The added point data is interpolated at new node positions whenever the deformed point set is being remeshed during the optimization.

If an array with the given name already exists, it is reused to avoid unnecessary allocations unless the data type or number of components mismatch. If _NumberOfPoints is set before by PointForce::Initialize, the corresponding number of array tuples are allocated by this function. Otherwise, the array is only instantiated, but not allocated.

Parameters
[in]nameName of array. The actual name of the point data array will be made unique by this function which stores an internal map from the given name to the unique array name.
[in]cNumber of components.
[in]typeType of data array (e.g., VTK_FLOAT, the default).
[in]globalWhether point data array is shared among point forces. If true, the array name is used unmodified such that other force terms can reuse the array.
Returns
Pointer to (newly instantiated) array.

§ EvaluateGradient()

virtual void mirtk::PointSetForce::EvaluateGradient ( double *  gradient,
double  step,
double  weight 
)
protectedvirtual

Evaluate gradient of force term

Parameters
[in,out]gradientGradient to which the computed gradient of the force term is added after multiplying by weight.
[in]stepStep length for finite differences (unused).
[in]weightWeight of force term.

Implements mirtk::EnergyTerm.

Reimplemented in mirtk::ImageEdgeDistance, mirtk::BalloonForce, mirtk::InternalForce, mirtk::MetricDistortion, mirtk::NonSelfIntersectionConstraint, mirtk::RepulsiveForce, mirtk::StretchingForce, mirtk::GaussCurvatureConstraint, mirtk::ImplicitSurfaceDistance, mirtk::CurvatureConstraint, mirtk::SpringForce, mirtk::ImageEdgeForce, mirtk::InflationForce, mirtk::QuadraticCurvatureConstraint, mirtk::MeanCurvatureConstraint, mirtk::MaximumCurvatureConstraint, and mirtk::NormalForce.

§ mirtkAggregateMacro()

mirtk::PointSetForce::mirtkAggregateMacro ( int  ,
Count   
)
protected

Number of summands in gradient computation

Intended for use by EvaluateGradient implementations only. Memory must be allocated by subclass, but will be freed by the base class.

§ mirtkPublicAttributeMacro()

mirtk::PointSetForce::mirtkPublicAttributeMacro ( bool  ,
AverageSignedGradients   
)
protected

Whether to only average gradient vectors pointing in the same direction as the unsmoothed gradient at the central node (i.e., positive dot product)

§ mirtkReadOnlyAttributeMacro()

mirtk::PointSetForce::mirtkReadOnlyAttributeMacro ( bool  ,
SurfaceForce   
)
protected

Whether this force is only acting on the point set surface

This read-only attribute must be set by the subclass constructor. It is in particular set by the SurfaceForce and SurfaceConstraint constructors.

§ PointData()

vtkDataArray* mirtk::PointSetForce::PointData ( const char *  name,
bool  optional = false 
) const
protected

Get point data array of deformed point set

Parameters
[in]nameName of array as used when the array was added before. This name may differ from the actual unique array name.
[in]optionalWhether the array may not exist. If false, this function raises an error if the array does not exist.
Returns
Point data array or nullptr if not found (only if optional = true).

§ Reinitialize()

virtual void mirtk::PointSetForce::Reinitialize ( )
virtual

Reinitialize force term after change of input topology

This function is called in particular when an input surface has been reparameterized, e.g., by a local remeshing filter.

Reimplemented in mirtk::MetricDistortion, mirtk::NonSelfIntersectionConstraint, mirtk::StretchingForce, mirtk::CurvatureConstraint, and mirtk::RepulsiveForce.

§ RemovePointData()

void mirtk::PointSetForce::RemovePointData ( const char *  name)
protected

Remove named array from point data attributes of deformed point set

Parameters
[in]nameName of array as used when the array was added before. This name may differ from the actual unique array name.

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