From 2963f5062eb189959255549787ee961878773bb3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 6 Oct 2016 11:59:33 +0200 Subject: hdf5_write_image(): Use correct dataspace for writing --- libcrystfel/src/hdf5-file.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libcrystfel') 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; pin_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); -- cgit v1.2.3