From cc3a464ec587e95ddfd421cd3836a7677dfb9744 Mon Sep 17 00:00:00 2001
From: Edoardo Pasca <edo.paskino@gmail.com>
Date: Wed, 23 Aug 2017 16:51:18 +0100
Subject: 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.
---
 src/Python/test/readhd5.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/Python/test/readhd5.py

(limited to 'src/Python/test')

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
-- 
cgit v1.2.3