aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5-file.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-29 15:29:33 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:22 +0100
commit0215205efb28d4ea24b93ce4005f4668a358cc32 (patch)
tree47b42b4c5b7b82a164a4513311ecd6948e8dfba7 /src/hdf5-file.c
parentabb1edf5301c36a814e65b9851c0848e35f82173 (diff)
Improve bad pixel handling
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r--src/hdf5-file.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index be0b5444..83850afe 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -412,22 +412,26 @@ int hdf5_read(struct hdfile *f, struct image *image, int satcorr)
}
image->data = buf;
- mask_dh = H5Dopen2(f->fh, "/processing/hitfinder/masks", H5P_DEFAULT);
- if ( mask_dh <= 0 ) {
- ERROR("Couldn't open flags\n");
- image->flags = NULL;
- } else {
- flags = malloc(sizeof(uint16_t)*f->nx*f->ny);
- r = H5Dread(mask_dh, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, flags);
- if ( r < 0 ) {
- ERROR("Couldn't read flags\n");
- free(flags);
+ if ( image->det->mask != NULL ) {
+
+ mask_dh = H5Dopen2(f->fh, image->det->mask, H5P_DEFAULT);
+ if ( mask_dh <= 0 ) {
+ ERROR("Couldn't open flags\n");
image->flags = NULL;
} else {
- image->flags = flags;
+ flags = malloc(sizeof(uint16_t)*f->nx*f->ny);
+ r = H5Dread(mask_dh, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, flags);
+ if ( r < 0 ) {
+ ERROR("Couldn't read flags\n");
+ free(flags);
+ image->flags = NULL;
+ } else {
+ image->flags = flags;
+ }
+ H5Dclose(mask_dh);
}
- H5Dclose(mask_dh);
+
}
/* Read wavelength from file */