diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2017-08-23 16:51:18 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2017-08-23 16:51:18 +0100 |
commit | cc3a464ec587e95ddfd421cd3836a7677dfb9744 (patch) | |
tree | caf6c2c65b83c704b09ca2fafc7c9c8e1a49f207 /src | |
parent | a2ca45848e354f376c53ecd3fed946d64c1ff3aa (diff) | |
download | regularization-cc3a464ec587e95ddfd421cd3836a7677dfb9744.tar.gz regularization-cc3a464ec587e95ddfd421cd3836a7677dfb9744.tar.bz2 regularization-cc3a464ec587e95ddfd421cd3836a7677dfb9744.tar.xz regularization-cc3a464ec587e95ddfd421cd3836a7677dfb9744.zip |
export/import data from hdf5
Added file to export the data from DemoRD2.m to HDF5 to pass it to Python.
Added file to import the data from DemoRD2.m from HDF5.
Diffstat (limited to 'src')
-rw-r--r-- | src/Python/test/readhd5.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Python/test/readhd5.py b/src/Python/test/readhd5.py new file mode 100644 index 0000000..1e19e14 --- /dev/null +++ b/src/Python/test/readhd5.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Aug 23 16:34:49 2017 + +@author: ofn77899 +""" + +import h5py +import numpy + +def getEntry(nx, location): + for item in nx[location].keys(): + print (item) + +filename = r'C:\Users\ofn77899\Documents\GitHub\CCPi-FISTA_reconstruction\Demos\DendrData.h5' +nx = h5py.File(filename, "r") +#getEntry(nx, '/') +# I have exported the entries as children of / +entries = [entry for entry in nx['/'].keys()] +print (entries) + +Sino3D = numpy.asarray(nx.get('/Sino3D')) +Weights3D = numpy.asarray(nx.get('/Weights3D')) +angSize = numpy.asarray(nx.get('/angSize'), dtype=int)[0] +angles_rad = numpy.asarray(nx.get('/angles_rad')) +recon_size = numpy.asarray(nx.get('/recon_size'), dtype=int)[0] +size_det = numpy.asarray(nx.get('/size_det'), dtype=int)[0] +slices_tot = numpy.asarray(nx.get('/slices_tot'), dtype=int)[0]
\ No newline at end of file |