aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/image.c13
-rw-r--r--libcrystfel/src/image.h3
-rw-r--r--libcrystfel/src/peaks.c5
3 files changed, 17 insertions, 4 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index f4a3384f..6a0495b1 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -106,15 +106,26 @@ void image_feature_list_free(ImageFeatureList *flist)
struct imagefeature *image_feature_closest(ImageFeatureList *flist,
double fs, double ss,
- double *d, int *idx)
+ double *d, int *idx,
+ struct detector *det)
{
int i;
double dmin = +HUGE_VAL;
int closest = 0;
+ struct panel *p1;
+
+ p1 = find_panel(det, fs, ss);
for ( i=0; i<flist->n_features; i++ ) {
double ds;
+ struct panel *p2;
+
+ p2 = find_panel(det, flist->features[i].fs, flist->features[i].ss);
+
+ if ( p1 != p2 ) {
+ continue;
+ }
ds = distance(flist->features[i].fs, flist->features[i].ss,
fs, ss);
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index d8ffa0ff..f19a7427 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -196,7 +196,8 @@ extern void image_remove_feature(ImageFeatureList *flist, int idx);
extern struct imagefeature *image_feature_closest(ImageFeatureList *flist,
double fs, double ss,
- double *d, int *idx);
+ double *d, int *idx,
+ struct detector *det);
extern int image_feature_count(ImageFeatureList *flist);
extern struct imagefeature *image_get_feature(ImageFeatureList *flist, int idx);
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 47bec10c..a38e4d4d 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -526,7 +526,8 @@ static void search_peaks_in_panel(struct image *image, float threshold,
}
/* Check for a nearby feature */
- image_feature_closest(image->features, f_fs, f_ss, &d, &idx);
+ image_feature_closest(image->features, f_fs, f_ss, &d, &idx,
+ image->det);
if ( d < 2.0*ir_inn ) {
nrej_pro++;
continue;
@@ -727,7 +728,7 @@ void validate_peaks(struct image *image, double min_snr,
}
/* Check for a nearby feature */
- image_feature_closest(flist, f_fs, f_ss, &d, &idx);
+ image_feature_closest(flist, f_fs, f_ss, &d, &idx, image->det);
if ( d < 2.0*ir_inn ) {
n_prx++;
continue;