aboutsummaryrefslogtreecommitdiff
path: root/src/make_pixelmap.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-04 15:25:19 +0200
committerThomas White <taw@physics.org>2020-08-04 15:25:19 +0200
commit43b71428b68e94d22c2c5f9e8a25b1b46bc04a4c (patch)
tree435b99f1a487c6144d7ec74a60cd5c3f0a784215 /src/make_pixelmap.c
parenta09f8c4cd9c4abe04b99129af07e51fdc5dad4b1 (diff)
Add image_create_for_simulation()
...and factorise common code
Diffstat (limited to 'src/make_pixelmap.c')
-rw-r--r--src/make_pixelmap.c13
1 files changed, 8 insertions, 5 deletions
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 <utils.h>
#include <datatemplate.h>
#include <detgeom.h>
+#include <image.h>
#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;
}