aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2014-07-23 13:26:30 +0200
committerThomas White <taw@physics.org>2014-07-24 13:26:34 +0200
commit7141d24cce2edfcafae40dce6213c108798e9dc5 (patch)
tree9c8643fa25762c21f4c4a43651282dd45c8d1984 /libcrystfel/src
parent282dee197bce06f9d37655c1775f53f6646e2e5d (diff)
Fixes closest feature detection bug
Diffstat (limited to 'libcrystfel/src')
-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;