diff options
-rw-r--r-- | libcrystfel/src/peaks.c | 21 | ||||
-rw-r--r-- | libcrystfel/src/peaks.h | 3 | ||||
-rw-r--r-- | src/indexamajig.c | 17 | ||||
-rw-r--r-- | src/process_image.c | 1 |
4 files changed, 27 insertions, 15 deletions
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index b416856a..25697c43 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -784,3 +784,24 @@ const char *str_peaksearch(enum peak_search_method meth) default: return "???"; } } + +enum peak_search_method parse_peaksearch(const char *arg) +{ + if ( strcmp(arg, "zaef") == 0 ) { + return PEAK_ZAEF; + } else if ( strcmp(arg, "peakfinder8") == 0 ) { + return PEAK_PEAKFINDER8; + } else if ( strcmp(arg, "hdf5") == 0 ) { + return PEAK_HDF5; + } else if ( strcmp(arg, "cxi") == 0 ) { + return PEAK_CXI; + } else if ( strcmp(arg, "peakfinder9") == 0 ) { + return PEAK_PEAKFINDER9; + } else if ( strcmp(arg, "msgpack") == 0 ) { + return PEAK_MSGPACK; + } else if ( strcmp(arg, "none") == 0 ) { + return PEAK_NONE; + } + + return PEAK_ERROR; +} diff --git a/libcrystfel/src/peaks.h b/libcrystfel/src/peaks.h index f1af1d32..c60bbe1e 100644 --- a/libcrystfel/src/peaks.h +++ b/libcrystfel/src/peaks.h @@ -58,10 +58,13 @@ enum peak_search_method { PEAK_CXI, PEAK_MSGPACK, PEAK_NONE, + PEAK_ERROR }; extern const char *str_peaksearch(enum peak_search_method meth); +extern enum peak_search_method parse_peaksearch(const char *arg); + extern int *make_BgMask(struct image *image, struct panel *p, double ir_inn); extern void search_peaks(struct image *image, float threshold, diff --git a/src/indexamajig.c b/src/indexamajig.c index 620026ad..e44f9576 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -225,21 +225,8 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state) break; case 301 : - if ( strcmp(arg, "zaef") == 0 ) { - args->iargs.peaks = PEAK_ZAEF; - } else if ( strcmp(arg, "peakfinder8") == 0 ) { - args->iargs.peaks = PEAK_PEAKFINDER8; - } else if ( strcmp(arg, "hdf5") == 0 ) { - args->iargs.peaks = PEAK_HDF5; - } else if ( strcmp(arg, "cxi") == 0 ) { - args->iargs.peaks = PEAK_CXI; - } else if ( strcmp(arg, "peakfinder9") == 0 ) { - args->iargs.peaks = PEAK_PEAKFINDER9; - } else if ( strcmp(arg, "msgpack") == 0 ) { - args->iargs.peaks = PEAK_MSGPACK; - } else if ( strcmp(arg, "none") == 0 ) { - args->iargs.peaks = PEAK_NONE; - } else { + args->iargs.peaks = parse_peaksearch(arg); + if ( args->iargs.peaks == PEAK_ERROR ) { ERROR("Unrecognised peak detection method '%s'\n", arg); return EINVAL; } diff --git a/src/process_image.c b/src/process_image.c index a7640718..b71fbec3 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -395,6 +395,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, break; case PEAK_NONE: + case PEAK_ERROR: break; } |