diff options
author | Thomas White <taw@physics.org> | 2011-05-16 17:46:09 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:27 +0100 |
commit | b90ec67959ca72cab7a9339600eeacba37370fa8 (patch) | |
tree | ba048d10d38ccd81a745b5db8a2ab33a76871ed0 /src/indexamajig.c | |
parent | c8057fc5efc6275ac05351d1ea79c49a295efc05 (diff) |
Add partial matching (against 'a' and 'b' only)
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r-- | src/indexamajig.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index 569a41bd..ed6b25c2 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -168,6 +168,7 @@ static void show_help(const char *s) " reduce : full cell reduction.\n" " compare : match by at most changing the order of\n" " the indices.\n" +" compare_ab : compare 'a' and 'b' lengths only.\n" " --filter-cm Perform common-mode noise subtraction on images\n" " before proceeding. Intensities will be extracted\n" " from the image as it is after this processing.\n" @@ -464,6 +465,29 @@ static void finalise_image(void *qp, void *pp) } +static int parse_cell_reduction(const char *scellr, int *err, + int *reduction_needs_cell) +{ + if ( strcmp(scellr, "none") == 0 ) { + *reduction_needs_cell = 0; + return CELLR_NONE; + } else if ( strcmp(scellr, "reduce") == 0) { + *reduction_needs_cell = 1; + return CELLR_REDUCE; + } else if ( strcmp(scellr, "compare") == 0) { + *reduction_needs_cell = 1; + return CELLR_COMPARE; + } else if ( strcmp(scellr, "compare_ab") == 0) { + *reduction_needs_cell = 1; + return CELLR_COMPARE_AB; + } else { + *err = 1; + *reduction_needs_cell = 0; + return CELLR_NONE; + } +} + + int main(int argc, char *argv[]) { int c; @@ -759,20 +783,17 @@ int main(int argc, char *argv[]) " I'm going to use 'reduce'.\n"); cellr = CELLR_REDUCE; reduction_needs_cell = 1; - } else if ( strcmp(scellr, "none") == 0 ) { - cellr = CELLR_NONE; - } else if ( strcmp(scellr, "reduce") == 0) { - cellr = CELLR_REDUCE; - reduction_needs_cell = 1; - } else if ( strcmp(scellr, "compare") == 0) { - cellr = CELLR_COMPARE; - reduction_needs_cell = 1; } else { - ERROR("Unrecognised cell reduction method '%s'\n", - scellr); - return 1; + int err; + cellr = parse_cell_reduction(scellr, &err, + &reduction_needs_cell); + if ( err ) { + ERROR("Unrecognised cell reduction '%s'\n", + scellr); + return 1; + } + free(scellr); } - free(scellr); /* free(NULL) is OK. */ } /* No indexing -> no reduction */ |