aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-06-30 13:37:21 +0200
committerThomas White <taw@physics.org>2016-07-01 10:19:37 +0200
commit2f8a70c3a0f85509dbda25d5511cd0a615a174dc (patch)
tree3f93f435fbf9e5c0cad15b49bc5fe0ab590537a0 /libcrystfel
parentcc371ca9a1c26771213ed0a91282fbe264e1bdc7 (diff)
Provide dataspace when reading data, mask and satmap
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/hdf5-file.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 95da2353..70e8cafe 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -1395,9 +1395,10 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
int hsi;
struct dim_structure *hsd;
herr_t check;
- hid_t dataspace;
+ hid_t dataspace, memspace;
int fail;
struct panel *p;
+ hsize_t dims[2];
p = &image->det->panels[pi];
@@ -1481,6 +1482,10 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
return 1;
}
+ dims[0] = p->h;
+ dims[1] = p->w;
+ memspace = H5Screate_simple(2, dims, NULL);
+
image->dp[pi] = malloc(p->w*p->h*sizeof(float));
image->sat[pi] = malloc(p->w*p->h*sizeof(float));
if ( (image->dp[pi] == NULL) || (image->sat[pi] == NULL) ) {
@@ -1491,7 +1496,7 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
}
for ( i=0; i<p->w*p->h; i++ ) image->sat[pi][i] = INFINITY;
- r = H5Dread(f->dh, H5T_NATIVE_FLOAT, H5S_ALL, dataspace,
+ r = H5Dread(f->dh, H5T_NATIVE_FLOAT, memspace, dataspace,
H5P_DEFAULT, image->dp[pi]);
if ( r < 0 ) {
ERROR("Couldn't read data for panel %s\n",
@@ -1503,7 +1508,7 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
if ( p->mask != NULL ) {
int *flags = malloc(p->w*p->h*sizeof(int));
- r = H5Dread(f->dh, H5T_NATIVE_FLOAT, H5S_ALL, dataspace,
+ r = H5Dread(f->dh, H5T_NATIVE_FLOAT, memspace, dataspace,
H5P_DEFAULT, flags);
if ( r < 0 ) {
ERROR("Couldn't read flags for panel %s\n",
@@ -1518,7 +1523,7 @@ int hdf5_read2(struct hdfile *f, struct image *image, struct event *ev,
}
if ( p->satmap != NULL ) {
- r = H5Dread(f->dh, H5T_NATIVE_FLOAT, H5S_ALL, dataspace,
+ r = H5Dread(f->dh, H5T_NATIVE_FLOAT, memspace, dataspace,
H5P_DEFAULT, image->sat[pi]);
if ( r < 0 ) {
ERROR("Couldn't read satmap for panel %s\n",