aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-10-06 11:59:33 +0200
committerThomas White <taw@physics.org>2016-10-06 12:00:34 +0200
commit2963f5062eb189959255549787ee961878773bb3 (patch)
tree89d54fdd3b3c3ea7d244183b6fd58794b7edd8aa /libcrystfel/src
parenteb9010df9526234cc1cc357e9f97e37f612de261 (diff)
hdf5_write_image(): Use correct dataspace for writing
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/hdf5-file.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index 5575a4b4..f0dc6a3c 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -730,7 +730,8 @@ static void write_location(hid_t fh, struct detector *det, float *data,
for ( pi=0; pi<loc->n_panels; pi++ ) {
- hsize_t f_offset[2], f_count[2];
+ hsize_t f_offset[2], f_count[2], dims[2];
+ hid_t memspace;
struct panel p;
int r;
@@ -755,19 +756,25 @@ static void write_location(hid_t fh, struct detector *det, float *data,
return;
}
- r = H5Dwrite(dh, H5T_NATIVE_FLOAT, H5S_ALL,
- dh_dataspace, H5P_DEFAULT, data);
+ dims[0] = p.h;
+ dims[1] = p.w;
+ memspace = H5Screate_simple(2, dims, NULL);
+
+ r = H5Dwrite(dh, H5T_NATIVE_FLOAT, memspace, dh_dataspace,
+ H5P_DEFAULT, data);
if ( r < 0 ) {
ERROR("Couldn't write data\n");
H5Pclose(ph);
H5Dclose(dh);
H5Sclose(dh_dataspace);
+ H5Sclose(memspace);
H5Sclose(sh);
H5Fclose(fh);
return;
}
H5Sclose(dh_dataspace);
+ H5Sclose(memspace);
}
H5Pclose(ph);
H5Sclose(sh);