From 0972792a889f6614c08380f52b08d919b7da31d1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 27 Oct 2020 15:27:52 +0100 Subject: Add a new StreamFlag for generating the detgeom structure This is a hack, and should be replaced by something which gets the metadata from the stream rather than hitting the read image file every time. --- libcrystfel/src/stream.c | 8 +++++--- libcrystfel/src/stream.h | 5 +++++ src/gui_project.c | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 25066314..08f0e332 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -990,9 +990,11 @@ struct image *stream_read_chunk(Stream *st, StreamFlags srf) if ( strcmp(line, STREAM_CHUNK_END_MARKER) == 0 ) { if ( have_filename && have_ev ) { /* Success */ - create_detgeom(image, st->dtempl); - image_set_zero_data(image, st->dtempl); - image_set_zero_mask(image, st->dtempl); + if ( srf & STREAM_DATA_DETGEOM ) { + create_detgeom(image, st->dtempl); + image_set_zero_data(image, st->dtempl); + image_set_zero_mask(image, st->dtempl); + } /* FIXME: Maybe arbitrary spectrum from file (?) */ image->spectrum = spectrum_generate_gaussian(image->lambda, image->bw); diff --git a/libcrystfel/src/stream.h b/libcrystfel/src/stream.h index 5eadf69b..3d57c7b6 100644 --- a/libcrystfel/src/stream.h +++ b/libcrystfel/src/stream.h @@ -75,6 +75,11 @@ typedef enum { /** Read the peak search results */ STREAM_PEAKS = 4, + /** Reconstruct the detgeom structure, + * and create (blank) data/mask arrays. + * (NB this is (currently) a slow operation) */ + STREAM_DATA_DETGEOM = 8, + } StreamFlags; #ifdef __cplusplus diff --git a/src/gui_project.c b/src/gui_project.c index 38e800ba..0c7d5502 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -865,7 +865,8 @@ struct image *find_result(struct crystfelproject *proj, } image = stream_read_chunk(st, STREAM_REFLECTIONS - | STREAM_PEAKS); + | STREAM_PEAKS + | STREAM_DATA_DETGEOM); stream_close(st); return image; -- cgit v1.2.3