aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5-file.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-06-02 11:48:50 +0200
committerThomas White <taw@physics.org>2010-06-02 11:48:50 +0200
commitd34f766f8963b58e32ea2d6021279a55d1ff9820 (patch)
treebe42969f5e8c8b050e4440dffa13ef662e45b271 /src/hdf5-file.c
parenta3de086613dd7f2098be05908544b1ff2d9fd432 (diff)
Take account of bad regions of detector
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r--src/hdf5-file.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index 5573267b..d635923d 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -318,6 +318,11 @@ int hdf5_read(struct hdfile *f, struct image *image)
{
herr_t r;
float *buf;
+ uint8_t *flags;
+ hid_t mask_dh;
+
+ image->height = f->nx;
+ image->width = f->ny;
buf = malloc(sizeof(float)*f->nx*f->ny);
@@ -327,10 +332,22 @@ int hdf5_read(struct hdfile *f, struct image *image)
ERROR("Couldn't read data\n");
return 1;
}
-
image->data = buf;
- image->height = f->nx;
- image->width = f->ny;
+
+ mask_dh = H5Dopen(f->fh, "/processing/hitfinder/masks", H5P_DEFAULT);
+ if ( mask_dh <= 0 ) {
+ ERROR("Couldn't open flags\n");
+ } else {
+ flags = malloc(sizeof(uint8_t)*f->nx*f->ny);
+ r = H5Dread(mask_dh, H5T_NATIVE_B8, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, flags);
+ if ( r < 0 ) {
+ ERROR("Couldn't read flags\n");
+ image->flags = NULL;
+ } else {
+ image->flags = flags;
+ }
+ }
/* Read wavelength from file */
image->lambda = get_wavelength(f);