From 38c560f7fc99383883890d746e74bd774a0309c7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 13 May 2017 12:04:47 +0200 Subject: indexamajig: Add --min-peaks (basic hitfinder functionality) --- src/indexamajig.c | 7 +++++++ src/process_image.c | 12 ++++++++++++ src/process_image.h | 1 + 3 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/indexamajig.c b/src/indexamajig.c index 439f9be3..fec7fc39 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -124,6 +124,7 @@ static void show_help(const char *s) " --max-pix-count= Only accept peaks if they include less than \n" " pixels, in the Peakfinder8 algorithm.\n" " Default: 200.\n" +" --min-peaks= Minimum number of peaks for indexing.\n" " --local-bg-radius= Radius (in pixels) to use for the estimation of\n" " local background in the Peakfinder8 algorithm.\n" " Default: 3.\n" @@ -258,6 +259,7 @@ int main(int argc, char *argv[]) iargs.stream_refls = 1; iargs.int_diag = INTDIAG_NONE; iargs.copyme = new_imagefile_field_list(); + iargs.min_peaks = 0; if ( iargs.copyme == NULL ) { ERROR("Couldn't allocate HDF5 field list.\n"); return 1; @@ -337,6 +339,7 @@ int main(int argc, char *argv[]) {"local-bg-radius", 1, NULL, 28}, {"min-res", 1, NULL, 29}, {"max-res", 1, NULL, 30}, + {"min-peaks", 1, NULL, 31}, {0, 0, NULL, 0} }; @@ -540,6 +543,10 @@ int main(int argc, char *argv[]) iargs.max_res = atoi(optarg); break; + case 31: + iargs.min_peaks = atoi(optarg); + break; + case 0 : break; diff --git a/src/process_image.c b/src/process_image.c index d3177d82..f735cb00 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -249,6 +249,17 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, image.bw = 0.00000001; } + if ( image_feature_count(image.features) < iargs->min_peaks ) { + r = chdir(rn); + if ( r ) { + ERROR("Failed to chdir: %s\n", strerror(errno)); + imagefile_close(imfile); + return; + } + free(rn); + goto streamwrite; + } + /* Index the pattern */ time_accounts_set(taccs, TACC_INDEXING); index_pattern_2(&image, iargs->ipriv, &sb_shared->pings[cookie]); @@ -292,6 +303,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, iargs->int_diag_k, iargs->int_diag_l, &sb_shared->term_lock); +streamwrite: time_accounts_set(taccs, TACC_WRITESTREAM); sb_shared->pings[cookie]++; ret = write_chunk(st, &image, imfile, diff --git a/src/process_image.h b/src/process_image.h index 14f90c78..a668f1ba 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -80,6 +80,7 @@ struct index_args int min_pix_count; int max_pix_count; int local_bg_radius; + int min_peaks; struct imagefile_field_list *copyme; int integrate_saturated; int use_saturated; -- cgit v1.2.3