aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-09 15:09:46 +0100
committerThomas White <taw@physics.org>2021-03-09 15:09:46 +0100
commitfb230df5c97b1a351db3d3aedbb90b59b8688651 (patch)
tree49927e97c843bb4d3764984852206338d95d6970 /libcrystfel/src/image.c
parent1ac8c79dce60517bd72d7d15c6c45dc9a0db1378 (diff)
Add the ability to use multiple bad pixel masks at once
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r--libcrystfel/src/image.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index c679fc6b..7e4a7549 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -809,11 +809,12 @@ static int load_mask(struct panel_template *p,
const char *mask_fn,
const char *ev,
int *bad,
+ const char *mask_location,
unsigned int mask_good,
unsigned int mask_bad)
{
if ( is_hdf5_file(mask_fn) ) {
- image_hdf5_read_mask(p, mask_fn, ev, bad,
+ image_hdf5_read_mask(p, mask_fn, ev, bad, mask_location,
mask_good, mask_bad);
} else if ( is_cbf_file(mask_fn) ) {
@@ -872,19 +873,31 @@ static int create_badmap(struct image *image,
image->bad[i]);
}
- /* Load mask (skip if panel is bad anyway) */
- if ( (!no_mask_data) && (!p->bad) && (p->mask != NULL) )
- {
- const char *mask_fn;
+ /* Load masks (skip if panel is bad anyway) */
+ if ( (!no_mask_data) && (!p->bad) ) {
- if ( p->mask_file == NULL ) {
- mask_fn = image->filename;
- } else {
- mask_fn = p->mask_file;
- }
+ int j;
- load_mask(p, mask_fn, image->ev, image->bad[i],
- dtempl->mask_good, dtempl->mask_bad);
+ for ( j=0; j<MAX_MASKS; j++ ) {
+
+ const char *mask_fn;
+
+ if ( p->masks[j].data_location == NULL ) {
+ continue;
+ }
+
+ if ( p->masks[j].filename == NULL ) {
+ mask_fn = image->filename;
+ } else {
+ mask_fn = p->masks[j].filename;
+ }
+
+ load_mask(p, mask_fn, image->ev, image->bad[i],
+ p->masks[j].data_location,
+ p->masks[j].good_bits,
+ p->masks[j].bad_bits);
+
+ }
}
}