123456789101112 |
- def create_hdf5(img_data, t2_data, img_label, save_path):
- assert img_data.shape == img_label.shape, 'shape of data and label must be the same..'
- f = h5py.File(save_path, "w")
- dset = f.create_dataset("t1data", img_data.shape, dtype=np.int16)
- tset = f.create_dataset("t2data", t2_data.shape, dtype=np.int16)
- lset = f.create_dataset("label", img_data.shape, dtype=np.uint8)
- dset[...] = img_data
- lset[...] = img_label
- tset[...] = t2_data
- print('saved hdf5 file in %s' % (save_path, ))
- f.close()
|