diff options
author | Thomas White <taw@physics.org> | 2011-03-07 11:27:16 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:17 +0100 |
commit | 3397bab94d8c495ffdaf74ff7de6a47f5a32df1a (patch) | |
tree | 92c7d637716d7085302516d1bd930a523a1ab9e8 | |
parent | b6c119939fcd95041c48035b27ebceaa19a4812e (diff) |
indexamajig: Use HDF5's camera length when requested
-rw-r--r-- | src/detector.c | 29 | ||||
-rw-r--r-- | src/detector.h | 2 | ||||
-rw-r--r-- | src/indexamajig.c | 3 |
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); |