diff options
author | Thomas White <taw@physics.org> | 2017-03-06 17:15:49 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-09-07 16:29:54 +0200 |
commit | 2ea5c535ac15aa0e429eb985a82f326cd2bce7c2 (patch) | |
tree | 07727b8b3cc64849338189a7f01f489732c574dd | |
parent | 141fb2cd3af6ea14098cc65ba3c64f93f72c9cf3 (diff) |
remove_flagged_crystals(): Return the number of crystals removed
-rw-r--r-- | libcrystfel/src/image.c | 5 | ||||
-rw-r--r-- | libcrystfel/src/image.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index aad5017c..8de16bd5 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -288,9 +288,10 @@ void image_add_crystal(struct image *image, Crystal *cryst) } -void remove_flagged_crystals(struct image *image) +int remove_flagged_crystals(struct image *image) { int i; + int n_bad = 0; for ( i=0; i<image->n_crystals; i++ ) { if ( crystal_get_user_flag(image->crystals[i]) ) { @@ -302,9 +303,11 @@ void remove_flagged_crystals(struct image *image) image->crystals[j] = image->crystals[j+1]; } image->n_crystals--; + n_bad++; } } + return n_bad; } diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index d7884e4c..c900bd29 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -257,7 +257,7 @@ extern struct imagefeature *image_get_feature(ImageFeatureList *flist, int idx); extern ImageFeatureList *sort_peaks(ImageFeatureList *flist); extern void image_add_crystal(struct image *image, Crystal *cryst); -extern void remove_flagged_crystals(struct image *image); +extern int remove_flagged_crystals(struct image *image); extern void free_all_crystals(struct image *image); /* Image files */ |