From 806844b14db4e87114bc355d2debd9e8f8846c67 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 6 Mar 2011 17:56:48 +0100 Subject: sum_stack: Accept (and use) threshold and min gradient on command line --- src/sum_stack.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/sum_stack.c b/src/sum_stack.c index 8bd5197e..3d2388ab 100644 --- a/src/sum_stack.c +++ b/src/sum_stack.c @@ -48,6 +48,7 @@ struct sum_args int h; SumMethod sum_method; double threshold; + double min_gradient; }; @@ -62,6 +63,7 @@ struct queue_args int h; SumMethod sum_method; double threshold; + double min_gradient; }; @@ -90,7 +92,9 @@ static void show_help(const char *s) " peaks : sum 10px radius circles around peaks.\n" " threshold : sum thresholded images.\n" " -t, --threshold= Set the threshold if summing using the 'threshold'\n" -" method.\n" +" method. Default: 400 adu\n" +" --min-gradient= Minimum gradient for Zaefferer peak search.\n" +" Default: 100,000.\n" "\n" " --filter-cm Perform common-mode noise subtraction on images\n" " before proceeding.\n" @@ -103,14 +107,14 @@ static void show_help(const char *s) } -static void sum_peaks(struct image *image, double *sum) +static void sum_peaks(struct image *image, double *sum, double threshold, + double min_gradient) { int x, y, i; int w = image->width; const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS; - /* FIXME: Get threshold value from command line */ - search_peaks(image, 800.0, 100000.0); + search_peaks(image, threshold, min_gradient); for ( i=0; ifeatures); i++ ) { @@ -204,7 +208,8 @@ static void add_image(void *args, int cookie) break; case SUM_PEAKS : - sum_peaks(&image, pargs->sum); + sum_peaks(&image, pargs->sum, pargs->threshold, + pargs->min_gradient); break; } @@ -237,6 +242,7 @@ static void *get_image(void *qp) pargs->h = qargs->h; pargs->sum_method = qargs->sum_method; pargs->threshold = qargs->threshold; + pargs->min_gradient = qargs->min_gradient; pargs->config_cmfilter = qargs->config_cmfilter; pargs->config_noisefilter = qargs->config_noisefilter; pargs->sum = qargs->sum; @@ -262,6 +268,7 @@ int main(int argc, char *argv[]) char *sum_str = NULL; char *intermediate = NULL; double threshold = 400.0; + float min_gradient = 100000.0; SumMethod sum; int nthreads = 1; struct queue_args qargs; @@ -279,6 +286,7 @@ int main(int argc, char *argv[]) {"sum", 1, NULL, 's'}, {"intermediate", 1, NULL, 'p'}, {"threshold", 1, NULL, 't'}, + {"min-gradient", 1, NULL, 4}, {0, 0, NULL, 0} }; @@ -319,6 +327,10 @@ int main(int argc, char *argv[]) threshold = atof(optarg); break; + case 4 : + min_gradient = strtof(optarg, NULL); + break; + case 0 : break; -- cgit v1.2.3