aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-05-13 12:04:47 +0200
committerThomas White <taw@physics.org>2017-06-21 14:26:02 +0200
commit38c560f7fc99383883890d746e74bd774a0309c7 (patch)
tree14deff6aab9832f8bcd00e90c28180e2d39d08a9 /src
parent5e9137947df9330308e1f66fa4a0701481ba6e06 (diff)
indexamajig: Add --min-peaks (basic hitfinder functionality)
Diffstat (limited to 'src')
-rw-r--r--src/indexamajig.c7
-rw-r--r--src/process_image.c12
-rw-r--r--src/process_image.h1
3 files changed, 20 insertions, 0 deletions
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=<n> Only accept peaks if they include less than <n>\n"
" pixels, in the Peakfinder8 algorithm.\n"
" Default: 200.\n"
+" --min-peaks=<n> Minimum number of peaks for indexing.\n"
" --local-bg-radius=<n> 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;