RadialErrorFunction.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_RadialErrorFunction_H
21 #define MIRTK_RadialErrorFunction_H
22 
23 #include "mirtk/Object.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Abstract radial fiducial registration error (FRE) function
31  */
33 {
34  mirtkAbstractMacro(RadialErrorFunction);
35 
36 protected:
37 
38  /// Constructor
40 
41 public:
42 
43  /// Enumeration of available error functions
44  enum TypeId {
45  Unknown, ///< Unknown/invalid/default function
46  Distance, ///< (Euclidean) distance
47  Squared, ///< Squared (Euclidean) distance
48  Gaussian, ///< Gaussian error function
49  Charbonnier, ///< Charbonnier fiducial registration error
50  PeronaMalik ///< Perona-Malik fiducial registration error
51  };
52 
53  /// Construct a new instance of specified type
55 
56  /// Construct a new instance of specified type
57  static RadialErrorFunction *New(const char *);
58 
59  /// Copy construct a new instance
60  virtual RadialErrorFunction *NewInstance() const = 0;
61 
62  /// Destructor
63  virtual ~RadialErrorFunction() = 0;
64 
65  /// Type enumeration value
66  virtual TypeId Type() const = 0;
67 
68  /// Evaluate radial registration error
69  ///
70  /// \param[in] d Squared (Euclidean) distance.
71  virtual double Value(double d) const = 0;
72 
73  /// Evaluate derivative of radial registration error
74  ///
75  /// \param[in] d Squared (Euclidean) distance.
76  virtual double Derivative(double d) const = 0;
77 
78 };
79 
80 
81 // -----------------------------------------------------------------------------
82 template <> bool FromString(const char *str, RadialErrorFunction::TypeId &);
83 template <> string ToString(const RadialErrorFunction::TypeId &, int, char, bool);
84 
85 
86 } // namespace mirtk
87 
88 #endif // MIRTK_RadialErrorFunction_H
Perona-Malik fiducial registration error.
virtual ~RadialErrorFunction()=0
Destructor.
RadialErrorFunction()
Constructor.
TypeId
Enumeration of available error functions.
static RadialErrorFunction * New(TypeId)
Construct a new instance of specified type.
Definition: IOConfig.h:41
virtual TypeId Type() const =0
Type enumeration value.
virtual RadialErrorFunction * NewInstance() const =0
Copy construct a new instance.
virtual double Derivative(double d) const =0
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.
Squared (Euclidean) distance.
virtual double Value(double d) const =0
Charbonnier fiducial registration error.
Unknown/invalid/default function.