aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-05-12 16:22:25 +0200
committerThomas White <taw@physics.org>2021-05-12 17:14:46 +0200
commit0fd2a367d1ba017d0c1cb112a648b71c4e355f78 (patch)
tree0114a7f0b6f03324981682a0858211f29fd89536 /libcrystfel/src/image.h
parent3a3401dfe7a7fedd5f133dd5a7b416e869f6be89 (diff)
Rework header caching layer
This clears up multiple layering violations which were starting to get in the way. It enables "string" headers to be stored directly, and it will make it much simpler to add new header types in the future. Along the way, this changes all the floating point header stuff to use double precision. This is needed for EuXFEL event IDs. Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/34
Diffstat (limited to 'libcrystfel/src/image.h')
-rw-r--r--libcrystfel/src/image.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h
index 045f3e77..0d8e7166 100644
--- a/libcrystfel/src/image.h
+++ b/libcrystfel/src/image.h
@@ -78,12 +78,20 @@ typedef struct _imagefeaturelist ImageFeatureList;
#define HEADER_CACHE_SIZE (128)
+typedef enum
+{
+ HEADER_FLOAT,
+ HEADER_INT,
+ HEADER_STR
+} HeaderCacheType;
+
struct header_cache_entry {
char *header_name;
- char type;
+ HeaderCacheType type;
union {
int val_int;
- float val_float;
+ double val_float;
+ char *val_str;
};
};
@@ -221,14 +229,24 @@ extern struct image *image_read_data_block(const DataTemplate *dtempl,
int no_mask_data);
extern void image_free(struct image *image);
+extern int image_read_header_float(struct image *image, const char *from,
+ double *val);
+
+/* NB image_read_header_int and image_read_header_str should exist, but there
+ * is currently no use for them. Get in touch if you disagree! */
+
extern void image_cache_header_float(struct image *image,
const char *header_name,
- float header_val);
+ double header_val);
extern void image_cache_header_int(struct image *image,
const char *header_name,
int header_val);
+extern void image_cache_header_str(struct image *image,
+ const char *header_name,
+ const char *header_val);
+
extern ImageFeatureList *image_read_peaks(const DataTemplate *dtempl,
const char *filename,
const char *event,