20 #ifndef MIRTK_InterpolationMode_H 21 #define MIRTK_InterpolationMode_H 23 #include "mirtk/String.h" 32 Interpolation_Default,
35 Interpolation_FastLinear,
36 Interpolation_BSpline,
37 Interpolation_CubicBSpline,
38 Interpolation_FastCubicBSpline,
39 Interpolation_CSpline,
42 Interpolation_Gaussian,
43 Interpolation_NNWithPadding,
44 Interpolation_LinearWithPadding,
45 Interpolation_FastLinearWithPadding,
46 Interpolation_BSplineWithPadding,
47 Interpolation_CubicBSplineWithPadding,
48 Interpolation_FastCubicBSplineWithPadding,
49 Interpolation_CSplineWithPadding,
50 Interpolation_SBasedWithPadding,
51 Interpolation_SincWithPadding,
52 Interpolation_GaussianWithPadding,
61 return Interpolation_FastLinear;
69 case Interpolation_NN:
return Interpolation_NNWithPadding;
70 case Interpolation_Linear:
return Interpolation_LinearWithPadding;
71 case Interpolation_FastLinear:
return Interpolation_FastLinearWithPadding;
72 case Interpolation_BSpline:
return Interpolation_BSplineWithPadding;
73 case Interpolation_CubicBSpline:
return Interpolation_CubicBSplineWithPadding;
74 case Interpolation_FastCubicBSpline:
return Interpolation_FastCubicBSplineWithPadding;
75 case Interpolation_CSpline:
return Interpolation_CSplineWithPadding;
76 case Interpolation_SBased:
return Interpolation_SBasedWithPadding;
77 case Interpolation_Sinc:
return Interpolation_SincWithPadding;
78 case Interpolation_Gaussian:
return Interpolation_GaussianWithPadding;
88 case Interpolation_NNWithPadding:
return Interpolation_NN;
89 case Interpolation_LinearWithPadding:
return Interpolation_Linear;
90 case Interpolation_FastLinearWithPadding:
return Interpolation_FastLinear;
91 case Interpolation_BSplineWithPadding:
return Interpolation_BSpline;
92 case Interpolation_CubicBSplineWithPadding:
return Interpolation_CubicBSpline;
93 case Interpolation_FastCubicBSplineWithPadding:
return Interpolation_FastCubicBSpline;
94 case Interpolation_CSplineWithPadding:
return Interpolation_CSpline;
95 case Interpolation_SBasedWithPadding:
return Interpolation_SBased;
96 case Interpolation_SincWithPadding:
return Interpolation_Sinc;
97 case Interpolation_GaussianWithPadding:
return Interpolation_Gaussian;
123 case Interpolation_Default: str =
"Default";
break;
124 case Interpolation_NN: str =
"NN";
break;
125 case Interpolation_Linear: str =
"Linear";
break;
126 case Interpolation_FastLinear: str =
"Fast linear";
break;
127 case Interpolation_BSpline: str =
"BSpline";
break;
128 case Interpolation_CSpline: str =
"CSpline";
break;
129 case Interpolation_CubicBSpline: str =
"Cubic BSpline";
break;
130 case Interpolation_FastCubicBSpline: str =
"Fast cubic BSpline";
break;
131 case Interpolation_SBased: str =
"SBased";
break;
132 case Interpolation_Sinc: str =
"Sinc";
break;
133 case Interpolation_Gaussian: str =
"Gaussian";
break;
134 default: str =
"Unknown";
break;
136 if (mode != m) str +=
" with padding";
145 bool with_padding =
false;
146 auto pos = lstr.find(
" (with padding)");
147 if (pos != string::npos) {
151 pos = lstr.find(
" with padding");
152 if (pos != string::npos) {
156 pos = lstr.find(
" (without padding)");
157 if (pos != string::npos) {
160 pos = lstr.find(
" without padding");
161 if (pos != string::npos) lstr.erase(pos, 16);
165 if (lstr ==
"default") m = Interpolation_Default;
166 else if (lstr ==
"nn") m = Interpolation_NN;
167 else if (lstr ==
"linear") m = Interpolation_Linear;
168 else if (lstr ==
"fast linear") m = Interpolation_FastLinear;
169 else if (lstr ==
"bspline") m = Interpolation_BSpline;
170 else if (lstr ==
"b-spline") m = Interpolation_BSpline;
171 else if (lstr ==
"cspline") m = Interpolation_CSpline;
172 else if (lstr ==
"c-spline") m = Interpolation_CSpline;
173 else if (lstr ==
"cubic bspline") m = Interpolation_CubicBSpline;
174 else if (lstr ==
"cubic b-spline") m = Interpolation_CubicBSpline;
175 else if (lstr ==
"fast cubic bspline") m = Interpolation_FastCubicBSpline;
176 else if (lstr ==
"fast cubic b-spline") m = Interpolation_FastCubicBSpline;
177 else if (lstr ==
"sbased") m = Interpolation_SBased;
178 else if (lstr ==
"shapebased") m = Interpolation_SBased;
179 else if (lstr ==
"shape-based") m = Interpolation_SBased;
180 else if (lstr ==
"sinc") m = Interpolation_Sinc;
181 else if (lstr ==
"gaussian") m = Interpolation_Gaussian;
192 #endif // MIRTK_InterpolationMode_H bool IsInterpolationWithPadding(InterpolationMode m)
Whether interpolation mode is "with padding".
InterpolationMode DefaultInterpolationMode()
Get default interpolation mode.
InterpolationMode
Image interpolation modes.
InterpolationMode InterpolationWithPadding(InterpolationMode m)
Get corresponding interpolation with padding.
string ToLower(const string &)
Convert string to lowercase letters.
InterpolationMode InterpolationWithoutPadding(InterpolationMode m)
Get corresponding interpolation without padding.
bool IsInterpolationWithoutPadding(InterpolationMode m)
Whether interpolation mode is "without padding".
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.