From 2ea5c535ac15aa0e429eb985a82f326cd2bce7c2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 6 Mar 2017 17:15:49 +0100 Subject: remove_flagged_crystals(): Return the number of crystals removed --- libcrystfel/src/image.c | 5 ++++- 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; in_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 */ -- cgit v1.2.3