59bool raw2HDF5_3D(
char *rawFilename,
int sizeX,
int sizeY,
int sizeZ,
int sizeChunk,
char *HDF5Filename)
66 hid_t datatype, dataspace;
78 fd = fopen(rawFilename,
"rb");
84 trace.
info() <<
" open raw_file: " << rawFilename <<
" size_X: " << sizeX <<
" size_Y: " << sizeY <<
" size_Z: " << sizeZ <<
" size_CHUNK: " << sizeChunk << endl;
95 if (fread(data, 1, sizeZ*sizeY*sizeX, fd) != (
unsigned)sizeZ*sizeY*sizeX)
110 file = H5Fcreate(HDF5Filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
116 dataspace = H5Screate_simple(
RANK_3D, dimsf, NULL);
119 plist_id = H5Pcreate(H5P_DATASET_CREATE);
122 cdims[0] = sizeChunk;
123 cdims[1] = sizeChunk;
124 cdims[2] = sizeChunk;
125 status = H5Pset_chunk(plist_id,
RANK_3D, cdims);
128 trace.
error() <<
" H5Dchunck error" << std::endl;
140 status = H5Pset_deflate(plist_id, 6);
143 trace.
error() <<
" H5Ddeflate error" << std::endl;
152 datatype = H5Tcopy(H5T_NATIVE_UINT8);
153 status = H5Tset_order(datatype, H5T_ORDER_LE);
156 trace.
error() <<
" H5Dset_order error" << std::endl;
166 H5P_DEFAULT, plist_id, H5P_DEFAULT);
169 trace.
info() <<
" begin write hdf5_file: " << HDF5Filename << endl;
170 status = H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
173 trace.
error() <<
" H5Dwrite error" << std::endl;
178 trace.
info() <<
" end write hdf5_file" << endl;
bool raw2HDF5_3D(char *rawFilename, int sizeX, int sizeY, int sizeZ, int sizeChunk, char *HDF5Filename)