[ismrmrd] 234/281: adding ISMRMRD Image creation to Python example

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.

commit 6a407898ba46009d2dfd42e8721465bb1d6fbc55
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date:   Thu May 29 10:29:19 2014 -0400

    adding ISMRMRD Image creation to Python example
---
 examples/python/ismrmrd_recon_dataset.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/examples/python/ismrmrd_recon_dataset.py b/examples/python/ismrmrd_recon_dataset.py
index 3d6c47d..a7f6803 100644
--- a/examples/python/ismrmrd_recon_dataset.py
+++ b/examples/python/ismrmrd_recon_dataset.py
@@ -101,3 +101,25 @@ for n, im in enumerate(images):
     a = fig.add_subplot(1, 5, n)
     plt.imshow(im)
 fig.set_size_inches(16, 4)
+
+# grab the first acquisition for extra info
+acqh = dset.readAcquisition(0).getHead()
+
+for n, img in enumerate(images):
+    hdr = ismrmrd.ImageHeader()
+    hdr.acquisition_time_stamp = acqh.acquisition_time_stamp
+    hdr.flags = 0
+    hdr.measurement_uid = acqh.measurement_uid
+    hdr.phase_dir = acqh.phase_dir
+    hdr.physiology_time_stamp = acqh.physiology_time_stamp
+    hdr.position = acqh.position
+    hdr.read_dir = acqh.read_dir
+    hdr.slice_dir = acqh.slice_dir
+    hdr.channels = 1
+    hdr.image_data_type = ismrmrd.DATA_FLOAT
+    hdr.image_type = ismrmrd.TYPE_MAGNITUDE
+    hdr.image_index = n
+    hdr.slice = n
+
+    dset.appendImageHeader(hdr, "image_%d.hdr" % n)
+    dset.appendArray(img, "image_%d.img" % n)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list