diff options
author | Thomas White <taw@physics.org> | 2021-04-23 16:26:24 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-04-23 16:40:56 +0200 |
commit | a378be62b61d4c8a67c5523955babbd3f9d17b5c (patch) | |
tree | 18062584caeee30145188e9fe1269837e34434ab /libcrystfel | |
parent | 4154688f5e91772f9a9c0d001316886b74686d9e (diff) |
indexamajig: Generate a unique filename for ZMQ data
The unique filename is needed by the GUI for looking up results in a
stream. Otherwise, the filename is "(null)" for everything and the
lookup just returns the first chunk in the stream.
The filename is generated based on the unique serial number for each
chunk, and is therefore unique across one run of indexamajig regardless
of the number of worker processes (-j). This might have to change in future
to accommodate jobs run across multiple nodes, if there is any demand
for looking at results in one big concatenated stream.
This also changes the condition for deciding when to look for a 'real'
file, to take into account that there is always a non-NULL filename.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/image.c | 9 | ||||
-rw-r--r-- | libcrystfel/src/image.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index ad651cae..b40819ef 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -669,7 +669,7 @@ int image_set_zero_mask(struct image *image, static int image_read_image_data(struct image *image, const DataTemplate *dtempl) { - if ( (image->filename != NULL) + if ( (image->data_block == NULL) && (!file_exists(image->filename)) ) { ERROR("File not found: %s (read data)\n", image->filename); @@ -1201,10 +1201,12 @@ struct image *image_read_data_block(const DataTemplate *dtempl, void *data_block, size_t data_block_size, DataSourceType type, + int serial, int no_image_data, int no_mask_data) { struct image *image; + char tmp[64]; if ( dtempl == NULL ) { ERROR("NULL data template!\n"); @@ -1217,8 +1219,9 @@ struct image *image_read_data_block(const DataTemplate *dtempl, return NULL; } - image->filename = NULL; - image->ev = NULL; + snprintf(tmp, 63, "datablock-%i", serial); + image->filename = strdup(tmp); + image->ev = strdup("//"); image->data_block = data_block; image->data_block_size = data_block_size; diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 58228e35..045f3e77 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -216,6 +216,7 @@ extern struct image *image_read_data_block(const DataTemplate *dtempl, void *data_block, size_t data_block_size, DataSourceType type, + int serial, int no_image_data, int no_mask_data); extern void image_free(struct image *image); |