aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-06-08 14:25:42 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commitdff386d1b0973c382e2453a91d9083480ee62175 (patch)
tree8bfc6c181ac613c7b9e9a467f0f74ba90cd26f0c /libcrystfel/src
parent3d51461b84e8b64bf155ea3c992ddb59020cb85f (diff)
Reinstate mark_resolution_range_as_bad
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/image.c30
-rw-r--r--libcrystfel/src/image.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index e51878d9..478bb2d1 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -612,3 +612,33 @@ struct event_list *image_expand_frames(const DataTemplate *dtempl,
/* FIXME: Dispatch to other versions, e.g. CBF files */
return image_hdf5_expand_frames(dtempl, filename);
}
+
+
+void mark_resolution_range_as_bad(struct image *image,
+ double min, double max)
+{
+ int i;
+
+ if ( isinf(min) && isinf(max) ) return; /* nothing to do */
+
+ for ( i=0; i<image->detgeom->n_panels; i++ ) {
+
+ int fs, ss;
+ struct detgeom_panel *p = &image->detgeom->panels[i];
+
+ for ( ss=0; ss<p->h; ss++ ) {
+ for ( fs=0; fs<p->w; fs++ ) {
+ double q[3];
+ double r;
+ detgeom_transform_coords(p, fs, ss,
+ image->lambda,
+ q);
+ r = modulus(q[0], q[1], q[2]);
+ if ( (r >= min) && (r <= max) ) {
+ image->bad[i][fs+p->w*ss] = 1;
+ }
+ }
+ }
+
+ }
+}
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index f54c7216..16f7d9f4 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -196,6 +196,8 @@ extern void image_add_crystal(struct image *image, Crystal *cryst);
extern int remove_flagged_crystals(struct image *image);
extern void free_all_crystals(struct image *image);
+extern void mark_resolution_range_as_bad(struct image *image,
+ double min, double max);
/* New API */
extern struct image *image_new(void);