PointSetDistanceMeasure.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_PointSetDistanceMeasure_H
21 #define MIRTK_PointSetDistanceMeasure_H
22 
23 #include "mirtk/EnergyMeasure.h"
24 
25 
26 namespace mirtk {
27 
28 
29 // -----------------------------------------------------------------------------
30 /// Enumeration of available point set distance measures
31 ///
32 /// \note This enumeration constains only a subset of all EnergyMeasure
33 /// enumeration values, whereby the integer value of corresponding
34 /// enumeration values is equal.
35 ///
36 /// \sa EnergyMeasure
38 {
39  PDM_Unknown = PDM_Begin,
40  PDM_FRE = EM_FRE,
41  PDM_CorrespondenceDistance = EM_CorrespondenceDistance,
42  PDM_CurrentsDistance = EM_CurrentsDistance,
43  PDM_VarifoldDistance = EM_VarifoldDistance,
44 };
45 
46 // -----------------------------------------------------------------------------
47 template <>
48 inline string ToString(const PointSetDistanceMeasure &pdm, int w, char c, bool left)
49 {
50  EnergyMeasure em = static_cast<EnergyMeasure>(pdm);
51  if (em <= PDM_Begin || em >= PDM_End) return ToString("Unknown", w, c, left);
52  return ToString(em, w, c, left);
53 }
54 
55 // -----------------------------------------------------------------------------
56 template <>
57 inline bool FromString(const char *str, PointSetDistanceMeasure &pdm)
58 {
60  if (FromString(str, em) && PDM_Begin < em && em < PDM_End) {
61  pdm = static_cast<PointSetDistanceMeasure>(em);
62  return true;
63  } else {
64  pdm = PDM_Unknown;
65  return false;
66  }
67 }
68 
69 
70 } // namespace mirtk
71 
72 #endif // MIRTK_PointSetDistanceMeasure_H
Distance measure based on currents representation.
Definition: EnergyMeasure.h:62
Fiducial registration error (FRE) measure.
Definition: EnergyMeasure.h:60
Definition: IOConfig.h:41
Point correspondence distance measure.
Definition: EnergyMeasure.h:61
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.
EnergyMeasure
Enumeration of all available energy terms.
Definition: EnergyMeasure.h:31
Unknown/invalid energy term.
Definition: EnergyMeasure.h:33
Distance measure based on varifold representation.
Definition: EnergyMeasure.h:63