aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.c
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/image.c
parent3d51461b84e8b64bf155ea3c992ddb59020cb85f (diff)
Reinstate mark_resolution_range_as_bad
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r--libcrystfel/src/image.c30
1 files changed, 30 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;
+ }
+ }
+ }
+
+ }
+}