20 #ifndef MIRTK_CharbonnierErrorFunction_H 21 #define MIRTK_CharbonnierErrorFunction_H 23 #include "mirtk/RadialErrorFunction.h" 25 #include "mirtk/Math.h" 39 mirtkPublicAttributeMacro(
double, SquaredThreshold);
46 _SquaredThreshold(threshold * threshold)
52 _SquaredThreshold(other._SquaredThreshold)
68 bool Set(
const char *name,
const char *value)
70 if (strcmp(name,
"Threshold") == 0) {
71 double threshold = .0;
72 if (!
FromString(value, threshold) || threshold <= .0)
return false;
73 _SquaredThreshold = threshold * threshold;
75 }
else if (strcmp(name,
"Squared threshold") == 0) {
76 return FromString(value, _SquaredThreshold) && _SquaredThreshold <= .0;
93 virtual double Value(
double d)
const 95 return 2.0 * _SquaredThreshold * (sqrt(1.0 + d / _SquaredThreshold) - 1.0);
101 return 1.0 / sqrt(1.0 + d / _SquaredThreshold);
109 #endif // MIRTK_CharbonnierErrorFunction_H ParameterList Parameter() const
Get parameter key/value as string map.
TypeId
Enumeration of available error functions.
Array< Pair< string, string > > ParameterList
Ordered list of parameter name/value pairs.
virtual TypeId Type() const
Type enumeration value.
virtual double Derivative(double d) const
Evaluate derivative of radial registration error.
virtual RadialErrorFunction * NewInstance() const
Copy construct a new instance.
string ToString(const EnergyMeasure &value, int w, char c, bool left)
Convert energy measure enumeration value to string.
bool FromString(const char *str, EnergyMeasure &value)
Convert energy measure string to enumeration value.
virtual double Value(double d) const
Evaluate radial registration error.
virtual ParameterList Parameter() const
Get parameter name/value pairs.
CharbonnierErrorFunction(const CharbonnierErrorFunction &other)
Copy constructor.
ParameterList & Insert(ParameterList ¶ms, string name, T value)
Insert/replace value into/in parameters list.
CharbonnierErrorFunction(double threshold=1.0)
Constructor.
bool Set(const char *name, const char *value)
Set parameter value from string.
Charbonnier fiducial registration error.