diff options
author | Thomas White <taw@physics.org> | 2020-07-09 16:31:54 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | 2c9de4119c0fe2338f5f6e54ee91294e3f0f6a74 (patch) | |
tree | 333f979756fc66ba594d2e718da6e6e99d0118a9 /libcrystfel/src/image.c | |
parent | 1cfbd01c2e0666fe7c888530e937ff4a310725f6 (diff) |
Add detector_shift_{x,y} to geometry file
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r-- | libcrystfel/src/image.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 47cbfea7..b70b920f 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -340,7 +340,8 @@ static char *get_value_and_units(struct image *image, const char *from, } -static double get_length(struct image *image, const char *from) +static double get_length(struct image *image, const char *from, + double default_scale) { char *units; double value; @@ -348,7 +349,7 @@ static double get_length(struct image *image, const char *from) units = get_value_and_units(image, from, &value); if ( units == NULL ) { - scale = 1.0e-3; + scale = default_scale; } else { if ( strcmp(units, "mm") == 0 ) { scale = 1e-3; @@ -421,13 +422,17 @@ void create_detgeom(struct image *image, const DataTemplate *dtempl) /* NB cnx,cny are in pixels, cnz is in m */ detgeom->panels[i].cnx = dtempl->panels[i].cnx; detgeom->panels[i].cny = dtempl->panels[i].cny; - detgeom->panels[i].cnz = get_length(image, dtempl->panels[i].cnz_from); + detgeom->panels[i].cnz = get_length(image, dtempl->panels[i].cnz_from, 1e-3); /* Apply offset (in m) and then convert cnz from * m to pixels */ detgeom->panels[i].cnz += dtempl->panels[i].cnz_offset; detgeom->panels[i].cnz /= detgeom->panels[i].pixel_pitch; + /* Apply overall shift (already in m) */ + detgeom->panels[i].cnx += get_length(image, dtempl->shift_x_from, 1.0); + detgeom->panels[i].cny += get_length(image, dtempl->shift_y_from, 1.0); + detgeom->panels[i].max_adu = dtempl->panels[i].max_adu; switch ( dtempl->panels[i].adu_scale_unit ) { |