aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-30 17:01:11 +0200
committerThomas White <taw@physics.org>2021-03-30 17:01:11 +0200
commit00f88dac5a2b63ec1c5f7ad65efef3d4f9d93b77 (patch)
treefc8a5f77c1b88f526cbdd7efb53b09183cc5ca14 /libcrystfel/src/image.h
parentab2158fb3f8053c6277113b4fb22007859f53de8 (diff)
Add header caching layer
This simultaneously implements --copy-header/--copy-hdf5-field and gives access to metadata (e.g. detector position or wavelength) when loading from a stream with header-specified values.
Diffstat (limited to 'libcrystfel/src/image.h')
-rw-r--r--libcrystfel/src/image.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index c3b55ba0..181d0433 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -7,7 +7,7 @@
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2009-2020 Thomas White <taw@physics.org>
+ * 2009-2021 Thomas White <taw@physics.org>
* 2014 Valerio Mariani
*
*
@@ -76,6 +76,18 @@ struct imagefeature {
typedef struct _imagefeaturelist ImageFeatureList;
+#define HEADER_CACHE_SIZE (128)
+
+struct header_cache_entry {
+ char *header_name;
+ char type;
+ union {
+ int val_int;
+ float val_float;
+ };
+};
+
+
struct image
{
/** The image data, by panel */
@@ -112,7 +124,8 @@ struct image
/** @} */
/** A list of metadata read from the stream */
- char *copied_headers;
+ struct header_cache_entry *header_cache[HEADER_CACHE_SIZE];
+ int n_cached_headers;
/** ID number of the worker processing handling this image */
int id;
@@ -184,6 +197,14 @@ extern struct image *image_read(const DataTemplate *dtempl,
extern struct image *image_create_for_simulation(const DataTemplate *dtempl);
extern void image_free(struct image *image);
+extern void image_cache_header_float(struct image *image,
+ const char *header_name,
+ float header_val);
+
+extern void image_cache_header_int(struct image *image,
+ const char *header_name,
+ int header_val);
+
extern ImageFeatureList *image_read_peaks(const DataTemplate *dtempl,
const char *filename,
const char *event,