aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-08-11 12:09:33 +0200
committerThomas White <taw@physics.org>2014-08-11 12:09:33 +0200
commita82278dbdd8311c46676b0921c423934208ec81a (patch)
tree4e70476e4f2e6d1b9609dc37e286f8cc6569faf1
parent55f6dd31901f05477d4c84437e4479d06059a56b (diff)
Take overlaps into account during integration
-rw-r--r--libcrystfel/src/integration.c35
-rw-r--r--libcrystfel/src/integration.h2
-rw-r--r--libcrystfel/src/peaks.c2
-rw-r--r--src/process_image.c2
4 files changed, 40 insertions, 1 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index f42da36f..5e5ddd98 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -1946,3 +1946,38 @@ IntegrationMethod integration_method(const char *str, int *err)
return meth;
}
+
+
+/**
+ * flag_overlaps:
+ * @image: An image structure
+ * @ir_inn: The radius of the peak region to use
+ *
+ * Flags, in the bad pixel mask for @image, every pixel for which more than one
+ * reflection is predicted to have its peak region.
+ *
+ */
+void flag_overlaps(struct image *image, double ir_inn)
+{
+ int i;
+
+ for ( i=0; i<image->det->n_panels; i++ ) {
+
+ int *mask;
+ int fs, ss;
+ struct panel *p = &image->det->panels[i];
+
+ mask = make_BgMask(image, p, ir_inn);
+
+ for ( ss=0; ss<p->h; ss++ ) {
+ for ( fs=0; fs<p->w; fs++ ) {
+ if ( mask[fs+p->w*ss] > 1 ) {
+ image->bad[i][fs+p->w*ss] = 1;
+ }
+ }
+ }
+
+ free(mask);
+
+ }
+}
diff --git a/libcrystfel/src/integration.h b/libcrystfel/src/integration.h
index 9e1c8ee1..6e80405c 100644
--- a/libcrystfel/src/integration.h
+++ b/libcrystfel/src/integration.h
@@ -112,6 +112,8 @@ extern void integrate_all_4(struct image *image, IntegrationMethod meth,
signed int idh, signed int idk, signed int idl,
int results_pipe);
+extern void flag_overlaps(struct image *image, double ir_inn);
+
#ifdef __cplusplus
}
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index a38e4d4d..ca5a6951 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -191,7 +191,7 @@ static void add_crystal_to_mask(struct image *image, struct panel *p,
if ( fs < 0 ) continue;
if ( ss < 0 ) continue;
- mask[fs + ss*w] = 1;
+ mask[fs + ss*w]++;
}
}
diff --git a/src/process_image.c b/src/process_image.c
index 434ea984..1431a16e 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -179,6 +179,8 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
crystal_set_mosaicity(image.crystals[i], 0.0); /* radians */
}
+ flag_overlaps(&image, iargs->ir_inn);
+
/* Integrate all the crystals at once - need all the crystals so that
* overlaps can be detected. */
integrate_all_4(&image, iargs->int_meth, PMODEL_SPHERE, iargs->push_res,