Skip to content

Commit

Permalink
enh: Use Split function to parse -model parameter [Registration]
Browse files Browse the repository at this point in the history
  • Loading branch information
schuhschuh committed Jul 16, 2017
1 parent ad9b54f commit 9dbc7d1
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions Modules/Registration/src/GenericRegistrationFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1456,30 +1456,15 @@ bool GenericRegistrationFilter::Set(const char *param, const char *value, int le
// Transformation model
} else if (name == "Transformation model") {
_TransformationModel.clear();
#ifdef WINDOWS
char *str = _strdup(value);
char *nxt = nullptr;
char *val = strtok_s(str, " \t,+", &nxt);
#else // WINDOWS
char *str = strdup(value);
char *val = strtok(str, " \t,+");
#endif // WINDOWS
while (val != nullptr) {
for (auto val : Split(value, '+')) {
enum TransformationModel model;
if (FromString(val, model)) {
if (FromString(Trim(val), model)) {
_TransformationModel.push_back(model);
} else {
_TransformationModel.clear();
free(str);
return false;
}
#ifdef WINDOWS
val = strtok_s(nullptr, " \t,+", &nxt);
#else // WINDOWS
val = strtok(nullptr, " \t,+");
#endif // WINDOWS
}
free(str);
return true;

// Restrict deformation along coordinate axis
Expand Down

0 comments on commit 9dbc7d1

Please sign in to comment.