summaryrefslogtreecommitdiffstats
path: root/src/Python
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2017-08-23 16:51:18 +0100
committerEdoardo Pasca <edo.paskino@gmail.com>2017-10-11 15:48:34 +0100
commita203949c84484fe2641e39451f033d20d445b1f3 (patch)
treee3f03559387a3ba4f0ddfd3ee8013bdb0cbde28c /src/Python
parent9f8fb57e1e89c1ad200d9c7eada5c653be34db66 (diff)
downloadregularization-a203949c84484fe2641e39451f033d20d445b1f3.tar.gz
regularization-a203949c84484fe2641e39451f033d20d445b1f3.tar.bz2
regularization-a203949c84484fe2641e39451f033d20d445b1f3.tar.xz
regularization-a203949c84484fe2641e39451f033d20d445b1f3.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/Python')
-rw-r--r--src/Python/test/readhd5.py28
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