aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/detector.c29
-rw-r--r--src/detector.h2
-rw-r--r--src/indexamajig.c3
3 files changed, 33 insertions, 1 deletions
diff --git a/src/detector.c b/src/detector.c
index b9d91118..dfff82a3 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -550,6 +550,35 @@ void free_detector_geometry(struct detector *det)
}
+struct detector *copy_geom(const struct detector *in)
+{
+ struct detector *out;
+ int i;
+
+ out = malloc(sizeof(struct detector));
+ memcpy(out, in, sizeof(struct detector));
+
+ out->panels = malloc(out->n_panels * sizeof(struct panel));
+ memcpy(out->panels, in->panels, out->n_panels * sizeof(struct panel));
+
+ for ( i=0; i<out->n_panels; i++ ) {
+
+ struct panel *p;
+
+ p = &out->panels[i];
+
+ if ( p->clen_from != NULL ) {
+ /* Make a copy of the clen_from fields unique to this
+ * copy of the structure. */
+ p->clen_from = strdup(p->clen_from);
+ }
+
+ }
+
+ return out;
+}
+
+
struct detector *simple_geometry(const struct image *image)
{
struct detector *geom;
diff --git a/src/detector.h b/src/detector.h
index c4e06cef..7db90e21 100644
--- a/src/detector.h
+++ b/src/detector.h
@@ -78,6 +78,8 @@ extern void get_pixel_extents(struct detector *det,
extern void fill_in_values(struct detector *det, struct hdfile *f);
+extern struct detector *copy_geom(const struct detector *in);
+
extern int reverse_2d_mapping(double x, double y, double *pfs, double *pss,
struct detector *det);
diff --git a/src/indexamajig.c b/src/indexamajig.c
index ea43cc7a..d896a2dc 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -208,7 +208,7 @@ static void process_image(void *pp, int cookie)
image.indexed_cell = NULL;
image.id = cookie;
image.filename = filename;
- image.det = pargs->static_args.det;
+ image.det = copy_geom(pargs->static_args.det);
STATUS("Processing '%s'\n", image.filename);
@@ -251,6 +251,7 @@ static void process_image(void *pp, int cookie)
return;
}
}
+ fill_in_values(image.det, hdfile);
if ( config_cmfilter ) {
filter_cm(&image);