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

#include <PointSetDistance.h>

Inheritance diagram for mirtk::PointSetDistance:
Inheritance graph
Collaboration diagram for mirtk::PointSetDistance:
Collaboration graph

Public Types

typedef Vector3D< double > GradientType
 Type of gradient w.r.t a single transformed data point.
 
- Public Types inherited from mirtk::EnergyTerm
typedef ObjectFactory< enum EnergyMeasure, EnergyTermFactoryType
 Type of energy term factory.
 

Public Member Functions

virtual void Initialize ()
 Initialize distance measure once input and parameters have been set.
 
virtual void Reinitialize ()
 
virtual void Update (bool=true)
 Update moving input points and internal state of distance measure.
 
virtual void WriteDataSets (const char *, const char *, bool=true) const
 Write input of data fidelity term.
 
virtual void WriteGradient (const char *, const char *) const
 Write gradient of data fidelity term w.r.t each transformed input.
 
virtual ~PointSetDistance ()
 Destructor.
 
- Public Member Functions inherited from mirtk::DataFidelity
virtual ~DataFidelity ()
 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.
 

Static Public Member Functions

static PointSetDistanceNew (PointSetDistanceMeasure, const char *="", double=1.0)
 Instantiate specified similarity measure.
 
- 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.
 

Protected Member Functions

void AllocateGradientWrtSource (int)
 Allocate memory for (non-parametric) gradient w.r.t points of source.
 
void AllocateGradientWrtTarget (int)
 Allocate memory for (non-parametric) gradient w.r.t points of target.
 
void CopyAttributes (const PointSetDistance &, int=-1, int=-1)
 Copy attributes from other point set distance measure.
 
virtual void EvaluateGradient (double *gradient, double step, double weight)
 
void Initialize (int, int)
 Initialize distance measure once input and parameters have been set.
 
 mirtkAttributeMacro (bool, InitialUpdate)
 Whether Update has not been called since initialization.
 
 mirtkComponentMacro (GradientType, GradientWrtTarget)
 Memory for (non-parametric) gradient w.r.t points of target.
 
 mirtkComponentMacro (GradientType, GradientWrtSource)
 Memory for (non-parametric) gradient w.r.t points of source.
 
 mirtkPublicAggregateMacro (RegisteredPointSet, Target)
 First point set.
 
 mirtkPublicAggregateMacro (RegisteredPointSet, Source)
 Second point set.
 
virtual void NonParametricGradient (const RegisteredPointSet *target, GradientType *gradient)=0
 
PointSetDistanceoperator= (const PointSetDistance &)
 Assignment operator.
 
virtual void ParametricGradient (const RegisteredPointSet *target, const GradientType *np_gradient, double *gradient, double weight)
 
 PointSetDistance (const char *="", double=1.0)
 Constructor.
 
 PointSetDistance (const PointSetDistance &, int=-1, int=-1)
 Copy constructor.
 
void Reinitialize (int, int)
 
virtual void WriteGradient (const char *, const RegisteredPointSet *, const GradientType *, const Array< int > *=NULL) const
 Write gradient of data fidelity term w.r.t each transformed input.
 
- Protected Member Functions inherited from mirtk::DataFidelity
 DataFidelity (const char *="", double=1.0)
 Constructor.
 
 DataFidelity (const DataFidelity &)
 Copy constructor.
 
DataFidelityoperator= (const DataFidelity &)
 Assignment operator.
 
virtual bool SetWithPrefix (const char *, const char *)
 Set parameter value from string.
 
- 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.
 
- 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 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 distance measures

Definition at line 37 of file PointSetDistance.h.

Member Function Documentation

§ EvaluateGradient()

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

Evaluate gradient of point set distance measure

This function calls the virtual NonParametricGradient function to be implemented by subclasses for each transformed input point set to obtain the gradient of the point set distance measure. It then converts this gradient into a gradient w.r.t the transformation parameters using the ParametricGradient.

If both target and source point sets are transformed by different transformations, the resulting gradient vector contains first the derivative values w.r.t the parameters of the target transformation followed by those computed w.r.t the parameters of the source transformation. If both point sets are transformed by the same transformation, the sum of the derivative values is added to the resulting gradient vector. This is in particular the case for a velocity based transformation model which is applied to deform both point sets "mid-way". Otherwise, only one input point set is transformed (usually the target) and the derivative values of only the respective transformation parameters added to the gradient vector.

See also
NonParametricGradient, ParametricGradient
Parameters
[in,out]gradientGradient to which the computed gradient of the point set distance measure is added after multiplying by the given similarity weight.
[in]stepStep length for finite differences (unused).
[in]weightWeight of point set distance measure.

Implements mirtk::EnergyTerm.

Reimplemented in mirtk::PointCorrespondenceDistance.

§ NonParametricGradient()

virtual void mirtk::PointSetDistance::NonParametricGradient ( const RegisteredPointSet target,
GradientType gradient 
)
protectedpure virtual

Compute non-parametric gradient w.r.t points of given data set

Parameters
[in]targetTransformed point set.
[out]gradientNon-parametric gradient of point set distance measure.

Implemented in mirtk::PointCorrespondenceDistance, and mirtk::CurrentsDistance.

§ ParametricGradient()

virtual void mirtk::PointSetDistance::ParametricGradient ( const RegisteredPointSet target,
const GradientType np_gradient,
double *  gradient,
double  weight 
)
protectedvirtual

Convert non-parametric gradient of point set distance measure into gradient w.r.t transformation parameters

This function calls Transformation::ParametricGradient of the transformation to apply the chain rule in order to obtain the gradient of the distance measure w.r.t the transformation parameters. It adds the weighted gradient to the final registration energy gradient.

Parameters
[in]targetTransformed point set.
[in]np_gradientPoint-wise non-parametric gradient.
[in,out]gradientGradient to which the computed parametric gradient is added, after multiplication by the given weight.
[in]weightWeight of point set distance measure.

Reimplemented in mirtk::PointCorrespondenceDistance, and mirtk::SurfaceDistance.

§ Reinitialize() [1/2]

void mirtk::PointSetDistance::Reinitialize ( int  ,
int   
)
protected

Reinitialize distance measure 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.

§ Reinitialize() [2/2]

virtual void mirtk::PointSetDistance::Reinitialize ( )
virtual

Reinitialize distance measure 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::PointCorrespondenceDistance, mirtk::CurrentsDistance, and mirtk::SurfaceDistance.


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