InternalForceTerm.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2016 Imperial College London
5  * Copyright 2013-2016 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_InternalForceTerm_H
21 #define MIRTK_InternalForceTerm_H
22 
23 #include "mirtk/EnergyMeasure.h"
24 
25 
26 namespace mirtk {
27 
28 
29 // -----------------------------------------------------------------------------
30 enum InternalForceTerm
31 {
32  IFT_Unknown = IFT_Begin,
33  IFT_Distortion = EM_MetricDistortion,
34  IFT_Stretching = EM_Stretching,
35  IFT_Curvature = EM_Curvature,
36  IFT_QuadraticCurvature = EM_QuadraticCurvature,
37  IFT_GaussCurvature = EM_GaussCurvature,
38  IFT_MeanCurvature = EM_MeanCurvature,
39  IFT_MaximumCurvature = EM_MaximumCurvature,
40  IFT_NonSelfIntersection = EM_NonSelfIntersection,
41  IFT_Repulsion = EM_RepulsiveForce,
42  IFT_Inflation = EM_InflationForce,
43  IFT_Spring = EM_SpringForce,
44  IFT_Normal = EM_NormalForce
45 };
46 
47 // -----------------------------------------------------------------------------
48 template <>
49 inline string ToString(const InternalForceTerm &ift, int w, char c, bool left)
50 {
51  EnergyMeasure em = static_cast<EnergyMeasure>(ift);
52  if (em <= IFT_Begin || em >= IFT_End) return ToString("Unknown", w, c, left);
53  return ToString(em, w, c, left);
54 }
55 
56 // -----------------------------------------------------------------------------
57 template <>
58 inline bool FromString(const char *str, InternalForceTerm &ift)
59 {
61  if (FromString(str, em) && IFT_Begin < em && em < IFT_End) {
62  ift = static_cast<InternalForceTerm>(em);
63  return true;
64  } else {
65  ift = IFT_Unknown;
66  return false;
67  }
68 }
69 
70 
71 } // namespace mirtk
72 
73 #endif // MIRTK_InternalForceTerm_H
Minimize metric distortion.
Definition: EnergyMeasure.h:80
Quadratic fit of neighor to tangent plane distance.
Definition: EnergyMeasure.h:83
Gauss curvature constraint.
Definition: EnergyMeasure.h:84
Repels too close non-neighboring triangles.
Definition: EnergyMeasure.h:87
Inflate point set surface.
Definition: EnergyMeasure.h:89
Definition: IOConfig.h:41
Constant force in normal direction.
Definition: EnergyMeasure.h:91
Minimize curvature of point set surface.
Definition: EnergyMeasure.h:82
Stretching force (rest edge length)
Definition: EnergyMeasure.h:81
Maximum curvature constraint.
Definition: EnergyMeasure.h:86
Repels too close non-neighboring nodes.
Definition: EnergyMeasure.h:88
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
Mean curvature constraint.
Definition: EnergyMeasure.h:85
Unknown/invalid energy term.
Definition: EnergyMeasure.h:33
Spring force.
Definition: EnergyMeasure.h:90