#include <EnergyTerm.h>
Public Types | |
typedef ObjectFactory< enum EnergyMeasure, EnergyTerm > | FactoryType |
Type of energy term factory. | |
Public Member Functions | |
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 |
virtual void | Initialize () |
Initialize energy term once input and parameters have been set. | |
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 void | Update (bool gradient=true) |
virtual bool | Upgrade () |
Update energy term after convergence. | |
double | Value () |
Evaluate energy term. | |
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 | ~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 FactoryType & | Factory () |
Get global energy term factory instance. | |
static EnergyTerm * | New (EnergyMeasure, const char *="", double=1.0) |
Construct new energy term. | |
static EnergyTerm * | TryNew (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 | |
EnergyTerm (const char *="", double=1.0) | |
Constructor. | |
EnergyTerm (const EnergyTerm &) | |
Copy constructor. | |
virtual double | Evaluate ()=0 |
Evaluate unweighted energy term. | |
virtual void | EvaluateGradient (double *gradient, double step, double weight)=0 |
EnergyTerm & | operator= (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. | |
Configurable & | operator= (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. | |
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 |
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) |
Base class for one term of an objective function
In particular, this is the base class for both the data similarity term and transformation regularization term commonly seen in objective functions used for image/surface registration.
Definition at line 41 of file EnergyTerm.h.
|
protectedpure virtual |
Evaluate and add gradient of energy term
[in,out] | gradient | Gradient to which the computed gradient of the energy term should be added to. |
[in] | step | Step length for finite differences. |
[in] | weight | Weight to use when adding the gradient. |
Implemented in mirtk::ImageSimilarity, mirtk::PointSetForce, mirtk::ImageEdgeDistance, mirtk::PointCorrespondenceDistance, mirtk::PointSetDistance, mirtk::BalloonForce, mirtk::JacobianConstraint, mirtk::InternalForce, mirtk::MetricDistortion, mirtk::NonSelfIntersectionConstraint, mirtk::RepulsiveForce, mirtk::StretchingForce, mirtk::MeanSquaredDisplacementError, mirtk::GaussCurvatureConstraint, mirtk::ImplicitSurfaceDistance, mirtk::CurvatureConstraint, mirtk::LinearElasticityConstraint, mirtk::SpringForce, mirtk::ImageEdgeForce, mirtk::SmoothnessConstraint, mirtk::InflationForce, mirtk::QuadraticCurvatureConstraint, mirtk::MeanCurvatureConstraint, mirtk::MaximumCurvatureConstraint, mirtk::SparsityConstraint, and mirtk::NormalForce.
void mirtk::EnergyTerm::Gradient | ( | double * | gradient, |
double | step | ||
) |
Evaluate gradient of energy term
[in,out] | gradient | Gradient to which the evaluated gradient of this energy term is added to with its resp. weight. |
[in] | step | Step length for finite differences. |
|
virtual |
Adjust step length range
[in] | gradient | Gradient of objective function. |
[in,out] | min | Minimum step length. |
[in,out] | max | Maximum step length. |
Reimplemented in mirtk::SparsityConstraint.
void mirtk::EnergyTerm::NormalizedGradient | ( | double * | gradient, |
double | step | ||
) |
Evaluate and normalize gradient of energy term
[in,out] | gradient | Gradient to which the evaluated normalized gradient of this energy term is added to with its resp. weight. |
[in] | step | Step length for finite differences. |
|
virtual |
Return unweighted and unnormalized raw energy term value
Reimplemented in mirtk::NormalizedIntensityCrossCorrelation, mirtk::NormalizedMutualImageInformation, mirtk::CosineOfNormalizedGradientField, mirtk::ImageCovariance, mirtk::JointImageEntropy, mirtk::MutualImageInformation, and mirtk::PeakSignalToNoiseRatio.
double mirtk::EnergyTerm::RawValue | ( | ) |
Return unweighted and unnormalized raw energy term value
|
virtual |
Update internal state after change of DoFs
[in] | gradient | Whether to also update internal state for evaluation of energy gradient. If false , only the internal state required for the energy evaluation need to be updated. |
Reimplemented in mirtk::PointSetForce, mirtk::ImageEdgeDistance, mirtk::ImageSimilarity, mirtk::PointCorrespondenceDistance, mirtk::NormalizedIntensityCrossCorrelation, mirtk::HistogramImageSimilarity, mirtk::BalloonForce, mirtk::CurrentsDistance, mirtk::PointSetDistance, mirtk::JacobianConstraint, mirtk::MetricDistortion, mirtk::NonSelfIntersectionConstraint, mirtk::GradientFieldSimilarity, mirtk::RepulsiveForce, mirtk::StretchingForce, mirtk::MeanSquaredDisplacementError, mirtk::GaussCurvatureConstraint, mirtk::ImplicitSurfaceDistance, mirtk::LinearElasticityConstraint, mirtk::CurvatureConstraint, mirtk::ExternalForce, mirtk::NormalizedGradientFieldSimilarity, mirtk::SumOfSquaredIntensityDifferences, mirtk::NormalizedMutualImageInformation, mirtk::QuadraticCurvatureConstraint, mirtk::MeanCurvatureConstraint, and mirtk::MaximumCurvatureConstraint.