From 43b71428b68e94d22c2c5f9e8a25b1b46bc04a4c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 4 Aug 2020 15:25:19 +0200 Subject: Add image_create_for_simulation() ...and factorise common code --- src/make_pixelmap.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/make_pixelmap.c') diff --git a/src/make_pixelmap.c b/src/make_pixelmap.c index cb5afcac..099ba79f 100644 --- a/src/make_pixelmap.c +++ b/src/make_pixelmap.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "version.h" @@ -181,6 +182,7 @@ int main(int argc, char *argv[]) float *x, *y, *z; uint16_t *b; float res; + struct image *image; int badmap = 0; int good_pixel_val = 1; int bad_pixel_val = 0; @@ -268,13 +270,13 @@ int main(int argc, char *argv[]) } free(input_file); - detgeom = data_template_to_detgeom(dtempl); - if ( detgeom == NULL ) { - ERROR("Could not make detector structure.\n"); - ERROR("Geometry file must not contain references to " - "image header values\n"); + image = image_create_for_simulation(dtempl); + if ( image == NULL ) { + ERROR("Geometry file seems to contain references to " + "image header values.\n"); return 1; } + detgeom = image->detgeom; /* Determine max orig fs and ss */ if ( data_template_get_slab_extents(dtempl, &w, &h) ) { @@ -346,6 +348,7 @@ int main(int argc, char *argv[]) } data_template_free(dtempl); + image_free(image); return 0; } -- cgit v1.2.3