[ismrmrd] 153/177: adding boilerplate Cython interface to libismrmrd

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


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

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit 2e523736b7f5df9ed3eb324829722a60d01929d7
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date:   Fri Sep 26 13:19:14 2014 -0400

    adding boilerplate Cython interface to libismrmrd
---
 bindings/python/.gitignore       |   2 +
 bindings/python/cismrmrd.pxd     | 184 +++++++++++++++-----
 bindings/python/cismrmrd.pxd.bak | 119 -------------
 bindings/python/demo.py          |  11 ++
 bindings/python/ismrmrd.pyx      | 355 ++++++++++++++++++++++++++++++++++++++-
 bindings/python/ismrmrd.pyx.bak  | 348 --------------------------------------
 bindings/python/test.py          |  13 --
 bindings/python/usage.py         |  26 ---
 8 files changed, 506 insertions(+), 552 deletions(-)

diff --git a/bindings/python/.gitignore b/bindings/python/.gitignore
index 71bc996..7e54d49 100644
--- a/bindings/python/.gitignore
+++ b/bindings/python/.gitignore
@@ -1 +1,3 @@
 ismrmrd.c
+*.so
+*.h5
diff --git a/bindings/python/cismrmrd.pxd b/bindings/python/cismrmrd.pxd
index 02d5c49..063ccb5 100644
--- a/bindings/python/cismrmrd.pxd
+++ b/bindings/python/cismrmrd.pxd
@@ -1,6 +1,6 @@
 from libc.stdint cimport uint16_t, uint32_t, uint64_t, int32_t
 
-cdef extern from "ismrmrd.h":
+cdef extern from "ismrmrd/ismrmrd.h":
     cdef enum:
         ISMRMRD_VERSION = 1
         ISMRMRD_USER_INTS = 8
@@ -11,61 +11,161 @@ cdef extern from "ismrmrd.h":
         ISMRMRD_POSITION_LENGTH = 3
         ISMRMRD_DIRECTION_LENGTH = 3
 
-    ctypedef struct EncodingCounters:
-        uint16_t kspace_encode_step_1  # e.g. phase encoding line number */
-        uint16_t kspace_encode_step_2  # e.g. partition encodning number */
-        uint16_t average               # e.g. signal average number */
-        uint16_t slice                 # e.g. imaging slice number */
-        uint16_t contrast              # e.g. echo number in multi-echo */
-        uint16_t phase                 # e.g. cardiac phase number */
-        uint16_t repetition            # e.g. dynamic number for dynamic scanning */
-        uint16_t set                   # e.g. flow encodning set */
-        uint16_t segment               # e.g. segment number for segmented acquisition */
-        uint16_t user[ISMRMRD_USER_INTS]   # Free user parameters */
+    ctypedef struct ISMRMRD_EncodingCounters:
+        uint16_t kspace_encode_step_1  # e.g. phase encoding line number
+        uint16_t kspace_encode_step_2  # e.g. partition encodning number
+        uint16_t average               # e.g. signal average number
+        uint16_t slice                 # e.g. imaging slice number
+        uint16_t contrast              # e.g. echo number in multi-echo
+        uint16_t phase                 # e.g. cardiac phase number
+        uint16_t repetition            # e.g. dynamic number for dynamic scanning
+        uint16_t set                   # e.g. flow encodning set
+        uint16_t segment               # e.g. segment number for segmented acquisition
+        uint16_t user[ISMRMRD_USER_INTS]   # Free user parameters
 
     ctypedef struct ISMRMRD_AcquisitionHeader:
-        uint16_t version   # First unsigned int indicates the version */
-        uint64_t flags     # bit field with flags */
-        uint32_t measurement_uid   # Unique ID for the measurement */
-        uint32_t scan_counter      # Current acquisition number in the measurement */
-        uint32_t acquisition_time_stamp    # Acquisition clock */
-        uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS] # Physiology time stamps, e.g. ecg, breating, etc. */
-        uint16_t number_of_samples # Number of samples acquired */
-        uint16_t available_channels    # Available coils */
-        uint16_t active_channels       # Active coils on current acquisiton */
-        uint64_t channel_mask[ISMRMRD_CHANNEL_MASKS]   # Mask to indicate which channels are active. Support for 1024 channels */
-        uint16_t discard_pre       # Samples to be discarded at the beginning of acquisition */
-        uint16_t discard_post      # Samples to be discarded at the end of acquisition */
-        uint16_t center_sample     # Sample at the center of k-space */
-        uint16_t encoding_space_ref    # Reference to an encoding space, typically only one per acquisition */
-        uint16_t trajectory_dimensions # Indicates the dimensionality of the trajectory vector (0 means no trajectory) */
-        float sample_time_us                                   # Time between samples in micro seconds, sampling BW */
-        float position[ISMRMRD_POSITION_LENGTH] # Three-dimensional spatial offsets from isocenter */
-        float read_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the readout/frequency encoding */
-        float phase_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the phase */
-        float slice_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the slice direction */
-        float patient_table_position[ISMRMRD_POSITION_LENGTH]  # Patient table off-center */
-        EncodingCounters idx       # Encoding loop counters, see above */
-        int32_t user_int[ISMRMRD_USER_INTS]       # Free user parameters */
-        float user_float[ISMRMRD_USER_FLOATS]     # Free user parameters */
+        uint16_t version   # First unsigned int indicates the version
+        uint64_t flags     # bit field with flags
+        uint32_t measurement_uid   # Unique ID for the measurement
+        uint32_t scan_counter      # Current acquisition number in the measurement
+        uint32_t acquisition_time_stamp    # Acquisition clock
+        uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS] # Physiology time stamps, e.g. ecg, breating, etc.
+        uint16_t number_of_samples # Number of samples acquired
+        uint16_t available_channels    # Available coils
+        uint16_t active_channels       # Active coils on current acquisiton
+        uint64_t channel_mask[ISMRMRD_CHANNEL_MASKS]   # Mask to indicate which channels are active. Support for 1024 channels
+        uint16_t discard_pre       # Samples to be discarded at the beginning of acquisition
+        uint16_t discard_post      # Samples to be discarded at the end of acquisition
+        uint16_t center_sample     # Sample at the center of k-space
+        uint16_t encoding_space_ref    # Reference to an encoding space, typically only one per acquisition
+        uint16_t trajectory_dimensions # Indicates the dimensionality of the trajectory vector (0 means no trajectory)
+        float sample_time_us                                   # Time between samples in micro seconds, sampling BW
+        float position[ISMRMRD_POSITION_LENGTH] # Three-dimensional spatial offsets from isocenter
+        float read_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the readout/frequency encoding
+        float phase_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the phase
+        float slice_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the slice direction
+        float patient_table_position[ISMRMRD_POSITION_LENGTH]  # Patient table off-center
+        ISMRMRD_EncodingCounters idx       # Encoding loop counters, see above
+        int32_t user_int[ISMRMRD_USER_INTS]       # Free user parameters
+        float user_float[ISMRMRD_USER_FLOATS]     # Free user parameters
 
     ctypedef struct ISMRMRD_Acquisition:
         ISMRMRD_AcquisitionHeader head
         float *traj
         float complex *data
 
-    cdef ISMRMRD_Acquisition ismrmrd_create_acquisition()
-    cdef void ismrmrd_free_acquisition(ISMRMRD_Acquisition*)
-    cdef size_t ismrmrd_size_of_acquisition_data(const ISMRMRD_Acquisition *)
+    cdef int ismrmrd_init_acquisition_header(ISMRMRD_AcquisitionHeader *hdr)
+    cdef ISMRMRD_Acquisition * ismrmrd_create_acquisition()
+    cdef int ismrmrd_free_acquisition(ISMRMRD_Acquisition *acq)
+    cdef int ismrmrd_init_acquisition(ISMRMRD_Acquisition *acq)
+    cdef int ismrmrd_cleanup_acquisition(ISMRMRD_Acquisition *acq)
+    cdef int ismrmrd_copy_acquisition(ISMRMRD_Acquisition *acqdest, const ISMRMRD_Acquisition *acqsource)
+    cdef int ismrmrd_make_consistent_acquisition(ISMRMRD_Acquisition *acq)
+    cdef size_t ismrmrd_size_of_acquisition_traj(const ISMRMRD_Acquisition *acq)
+    cdef size_t ismrmrd_size_of_acquisition_data(const ISMRMRD_Acquisition *acq)
+
+
+    cdef enum ISMRMRD_ImageDataTypes:
+        ISMRMRD_USHORT = 1 # corresponds to uint16_t
+        ISMRMRD_SHORT      # corresponds to int16_t
+        ISMRMRD_UINT       # corresponds to uint32_t
+        ISMRMRD_INT        # corresponds to int32_t
+        ISMRMRD_FLOAT      # corresponds to float
+        ISMRMRD_DOUBLE     # corresponds to double
+        ISMRMRD_CXFLOAT    # corresponds to complex float
+        ISMRMRD_CXDOUBLE   # corresponds to complex double
+
+    cdef enum ISMRMRD_ImageTypes:
+        ISMRMRD_IMTYPE_MAGNITUDE = 1
+        ISMRMRD_IMTYPE_PHASE
+        ISMRMRD_IMTYPE_REAL
+        ISMRMRD_IMTYPE_IMAG
+        ISMRMRD_IMTYPE_COMPLEX
+
+    # IMAGE FLAGS
+    cdef enum ISMRMRD_ImageFlags:
+        ISMRMRD_IMAGE_IS_NAVIGATION_DATA = 1    # used to be 23?
+        ISMRMRD_IMAGE_USER1 = 57
+        ISMRMRD_IMAGE_USER2 = 58
+        ISMRMRD_IMAGE_USER3 = 59
+        ISMRMRD_IMAGE_USER4 = 60
+        ISMRMRD_IMAGE_USER5 = 61
+        ISMRMRD_IMAGE_USER6 = 62
+        ISMRMRD_IMAGE_USER7 = 63
+        ISMRMRD_IMAGE_USER8 = 64
+
+    ctypedef struct ISMRMRD_ImageHeader:
+        uint16_t version    # First unsigned int indicates the version
+        uint64_t flags      # bit field with flags
+        uint32_t measurement_uid    # Unique ID for the measurement
+        uint16_t matrix_size[3]     # Pixels in the 3 spatial dimensions
+        float field_of_view[3]      # Size (in mm) of the 3 spatial dimensions
+        uint16_t channels           # Number of receive channels
+        float position[ISMRMRD_POSITION_LENGTH]     # Three-dimensional spatial offsets from isocenter
+        float read_dir[ISMRMRD_DIRECTION_LENGTH]    # Directional cosines of the readout/frequency encoding
+        float phase_dir[ISMRMRD_DIRECTION_LENGTH]   # Directional cosines of the phase
+        float slice_dir[ISMRMRD_DIRECTION_LENGTH]   # Directional cosines of the slice direction
+        float patient_table_position[ISMRMRD_POSITION_LENGTH] # Patient table off-center
+        uint16_t average    # e.g. signal average number
+        uint16_t slice      # e.g. imaging slice number
+        uint16_t contrast   # e.g. echo number in multi-echo
+        uint16_t phase      # e.g. cardiac phase number
+        uint16_t repetition # e.g. dynamic number for dynamic scanning
+        uint16_t set        # e.g. flow encodning set
+        uint32_t acquisition_time_stamp # Acquisition clock
+        uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS] # Physiology time stamps, e.g. ecg, breating, etc.
+        uint16_t image_data_type    # e.g. unsigned short, float, complex float, etc.
+        uint16_t image_type     # e.g. magnitude, phase, complex, real, imag, etc.
+        uint16_t image_index    # e.g. image number in series of images
+        uint16_t image_series_index             # e.g. series number
+        int32_t user_int[ISMRMRD_USER_INTS]     # Free user parameters
+        float user_float[ISMRMRD_USER_FLOATS]   # Free user parameters
 
     ctypedef struct ISMRMRD_Image:
-        pass
+        ISMRMRD_ImageHeader head
+        char *attribute_string
+        void *data
+
+    cdef int ismrmrd_init_image_header(ISMRMRD_ImageHeader *hdr)
+    cdef ISMRMRD_Image * ismrmrd_create_image()
+    cdef int ismrmrd_free_image(ISMRMRD_Image *im)
+    cdef int ismrmrd_init_image(ISMRMRD_Image *im)
+    cdef int ismrmrd_cleanup_image(ISMRMRD_Image *im)
+    cdef int ismrmrd_copy_image(ISMRMRD_Image *imdest, const ISMRMRD_Image *imsource)
+    cdef int ismrmrd_make_consistent_image(ISMRMRD_Image *im)
+    cdef size_t ismrmrd_size_of_image_attribute_string(const ISMRMRD_Image *im)
+    cdef size_t ismrmrd_size_of_image_data(const ISMRMRD_Image *im)
+
 
     ctypedef struct ISMRMRD_NDArray:
-        pass
+        uint16_t version                      # First unsigned int indicates the version
+        uint16_t data_type                    # e.g. unsigned short, float, complex float, etc.
+        uint16_t ndim                         # Number of dimensions
+        uint16_t dims[ISMRMRD_NDARRAY_MAXDIM] # Dimensions
+        void *data                            # Pointer to data
+
+    cdef ISMRMRD_NDArray * ismrmrd_create_ndarray()
+    cdef int ismrmrd_free_ndarray(ISMRMRD_NDArray *arr)
+    cdef int ismrmrd_init_ndarray(ISMRMRD_NDArray *arr)
+    cdef int ismrmrd_cleanup_ndarray(ISMRMRD_NDArray *arr)
+    cdef int ismrmrd_copy_ndarray(ISMRMRD_NDArray *arrdest, const ISMRMRD_NDArray *arrsource)
+    cdef int ismrmrd_make_consistent_ndarray(ISMRMRD_NDArray *arr)
+    cdef size_t ismrmrd_size_of_ndarray_data(const ISMRMRD_NDArray *arr)
+
+
+    cdef bint ismrmrd_is_flag_set(const uint64_t flags, const uint64_t val)
+    cdef int ismrmrd_set_flag(uint64_t *flags, const uint64_t val)
+    cdef int ismrmrd_clear_flag(uint64_t *flags, const uint64_t val)
+    cdef int ismrmrd_clear_all_flags(uint64_t *flags)
 
+    cdef int ismrmrd_sign_of_directions(float read_dir[3],
+            float phase_dir[3], float slice_dir[3])
+    cdef void ismrmrd_directions_to_quaternion(float read_dir[3],
+            float phase_dir[3], float slice_dir[3], float quat[4])
+    cdef void ismrmrd_quaternion_to_directions(float quat[4],
+            float read_dir[3], float phase_dir[3], float slice_dir[3])
 
-cdef extern from "ismrmrd_dataset.h":
+cdef extern from "ismrmrd/dataset.h":
     cdef enum BlockModes:
         BLOCKMODE_ARRAY
         BLOCKMODE_BLOB
diff --git a/bindings/python/cismrmrd.pxd.bak b/bindings/python/cismrmrd.pxd.bak
deleted file mode 100644
index 364960e..0000000
--- a/bindings/python/cismrmrd.pxd.bak
+++ /dev/null
@@ -1,119 +0,0 @@
-from libc.stdint cimport uint16_t, uint32_t, uint64_t, int32_t
-
-cdef extern from "ismrmrd_ext.h":
-    EncodingCounters* EncodingCounters_new()
-    AcquisitionHeader* AcquisitionHeader_new()
-    ImageHeader* ImageHeader_new()
-    void EncodingCounters_free(EncodingCounters*)
-    void AcquisitionHeader_free(AcquisitionHeader*)
-    void ImageHeader_free(ImageHeader*)
-
-cdef extern from "ismrmrd.h":
-    cdef enum:
-        ISMRMRD_VERSION
-        ISMRMRD_POSITION_LENGTH
-        ISMRMRD_DIRECTION_LENGTH
-        ISMRMRD_USER_INTS
-        ISMRMRD_USER_FLOATS
-        ISMRMRD_PHYS_STAMPS
-        ISMRMRD_CHANNEL_MASKS
-        # ISMRMRD_VERSION          = 1
-        # ISMRMRD_POSITION_LENGTH  = 3
-        # ISMRMRD_DIRECTION_LENGTH = 3
-        # ISMRMRD_USER_INTS        = 8
-        # ISMRMRD_USER_FLOATS      = 8
-        # ISMRMRD_PHYS_STAMPS      = 8  # TODO: This should be changed to 3 (Major impact)
-        # ISMRMRD_CHANNEL_MASKS    = 16
-
-cdef extern from "ismrmrd.h":
-    ctypedef struct EncodingCounters:
-        uint16_t kspace_encode_step_1  # e.g. phase encoding line number */
-        uint16_t kspace_encode_step_2  # e.g. partition encodning number */
-        uint16_t average               # e.g. signal average number */
-        uint16_t slice                 # e.g. imaging slice number */
-        uint16_t contrast              # e.g. echo number in multi-echo */
-        uint16_t phase                 # e.g. cardiac phase number */
-        uint16_t repetition            # e.g. dynamic number for dynamic scanning */
-        uint16_t set                   # e.g. flow encodning set */
-        uint16_t segment               # e.g. segment number for segmented acquisition */
-        uint16_t user[ISMRMRD_USER_INTS]   # Free user parameters */
-
-    ctypedef struct AcquisitionHeader:
-        uint16_t version   # First unsigned int indicates the version */
-        uint64_t flags     # bit field with flags */
-        uint32_t measurement_uid   # Unique ID for the measurement */
-        uint32_t scan_counter      # Current acquisition number in the measurement */
-        uint32_t acquisition_time_stamp    # Acquisition clock */
-        uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS] # Physiology time stamps, e.g. ecg, breating, etc. */
-        uint16_t number_of_samples # Number of samples acquired */
-        uint16_t available_channels    # Available coils */
-        uint16_t active_channels       # Active coils on current acquisiton */
-        uint64_t channel_mask[ISMRMRD_CHANNEL_MASKS]   # Mask to indicate which channels are active. Support for 1024 channels */
-        uint16_t discard_pre       # Samples to be discarded at the beginning of acquisition */
-        uint16_t discard_post      # Samples to be discarded at the end of acquisition */
-        uint16_t center_sample     # Sample at the center of k-space */
-        uint16_t encoding_space_ref    # Reference to an encoding space, typically only one per acquisition */
-        uint16_t trajectory_dimensions # Indicates the dimensionality of the trajectory vector (0 means no trajectory) */
-        float sample_time_us                                   # Time between samples in micro seconds, sampling BW */
-        float position[ISMRMRD_POSITION_LENGTH] # Three-dimensional spatial offsets from isocenter */
-        float read_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the readout/frequency encoding */
-        float phase_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the phase */
-        float slice_dir[ISMRMRD_DIRECTION_LENGTH] # Directional cosines of the slice direction */
-        float patient_table_position[ISMRMRD_POSITION_LENGTH]  # Patient table off-center */
-        EncodingCounters idx       # Encoding loop counters, see above */
-        int32_t user_int[ISMRMRD_USER_INTS]       # Free user parameters */
-        float user_float[ISMRMRD_USER_FLOATS]     # Free user parameters */
-
-    cdef enum ImageDataType:
-        DATA_FLOAT = 1
-        DATA_DOUBLE
-        DATA_COMPLEX_FLOAT
-        DATA_COMPLEX_DOUBLE
-        DATA_UNSIGNED_SHORT
-
-    cdef enum ImageType:
-        TYPE_MAGNITUDE = 1
-        TYPE_PHASE
-        TYPE_REAL
-        TYPE_IMAG
-        TYPE_COMPLEX
-
-    # IMAGE FLAGS
-    cdef enum ImageFlags:
-        IMAGE_IS_NAVIGATION_DATA                      = 23
-
-        IMAGE_USER1                                   = 57
-        IMAGE_USER2                                   = 58
-        IMAGE_USER3                                   = 59
-        IMAGE_USER4                                   = 60
-        IMAGE_USER5                                   = 61
-        IMAGE_USER6                                   = 62
-        IMAGE_USER7                                   = 63
-        IMAGE_USER8                                   = 64
-
-    ctypedef struct ImageHeader:
-        uint16_t version    # First unsigned int indicates the version */
-        uint64_t flags      # bit field with flags */
-        uint32_t measurement_uid    # Unique ID for the measurement  */
-        uint16_t matrix_size[3]     # Pixels in the 3 spatial dimensions */
-        float field_of_view[3]      # Size (in mm) of the 3 spatial dimensions */
-        uint16_t channels           # Number of receive channels */
-        float position[ISMRMRD_POSITION_LENGTH]     # Three-dimensional spatial offsets from isocenter */
-        float read_dir[ISMRMRD_DIRECTION_LENGTH]    # Directional cosines of the readout/frequency encoding */
-        float phase_dir[ISMRMRD_DIRECTION_LENGTH]   # Directional cosines of the phase */
-        float slice_dir[ISMRMRD_DIRECTION_LENGTH]   # Directional cosines of the slice direction */
-        float patient_table_position[ISMRMRD_POSITION_LENGTH] # Patient table off-center */
-        uint16_t average    # e.g. signal average number */
-        uint16_t slice      # e.g. imaging slice number */
-        uint16_t contrast   # e.g. echo number in multi-echo */
-        uint16_t phase      # e.g. cardiac phase number */
-        uint16_t repetition # e.g. dynamic number for dynamic scanning */
-        uint16_t set        # e.g. flow encodning set */
-        uint32_t acquisition_time_stamp # Acquisition clock */
-        uint32_t physiology_time_stamp[ISMRMRD_PHYS_STAMPS] # Physiology time stamps, e.g. ecg, breating, etc. */
-        uint16_t image_data_type    # e.g. unsigned short, float, complex float, etc. */
-        uint16_t image_type     # e.g. magnitude, phase, complex, real, imag, etc. */
-        uint16_t image_index    # e.g. image number in series of images  */
-        uint16_t image_series_index             # e.g. series number */
-        int32_t user_int[ISMRMRD_USER_INTS]     # Free user parameters */
-        float user_float[ISMRMRD_USER_FLOATS]   # Free user parameters */
diff --git a/bindings/python/demo.py b/bindings/python/demo.py
new file mode 100644
index 0000000..8ce439b
--- /dev/null
+++ b/bindings/python/demo.py
@@ -0,0 +1,11 @@
+import ismrmrd
+
+acq = ismrmrd.Acquisition()
+acq.head.version = 42
+print(acq.head.version) 
+
+img = ismrmrd.Image()
+
+f = ismrmrd.Dataset('./testdata.h5', '/dataset', True)
+print f.filename
+# xml = f.readHeader()
diff --git a/bindings/python/ismrmrd.pyx b/bindings/python/ismrmrd.pyx
index 68cba70..0d60efe 100644
--- a/bindings/python/ismrmrd.pyx
+++ b/bindings/python/ismrmrd.pyx
@@ -1,13 +1,74 @@
 cimport cismrmrd
-cimport numpy as np
 from libc.stdlib cimport calloc, free
 from libc.string cimport memcpy
 
+#### Helper functions
+
 cdef AcquisitionHeader_from_struct(cismrmrd.ISMRMRD_AcquisitionHeader *other):
     head = AcquisitionHeader()
     memcpy(head.this, other, sizeof(cismrmrd.ISMRMRD_AcquisitionHeader))
     return head
 
+cdef ImageHeader_from_struct(cismrmrd.ISMRMRD_ImageHeader *other):
+    head = ImageHeader()
+    memcpy(head.this, other, sizeof(cismrmrd.ISMRMRD_ImageHeader))
+    return head
+
+####
+
+cdef class EncodingCounters:
+    cdef cismrmrd.ISMRMRD_EncodingCounters *this
+    def __cinit__(self):
+        self.this = <cismrmrd.ISMRMRD_EncodingCounters*>calloc(1, sizeof(cismrmrd.ISMRMRD_EncodingCounters))
+    def __dealloc__(self):
+        free(self.this)
+
+    property kspace_encode_step_1:
+        def __get__(self): return self.thisptr.kspace_encode_step_1
+        def __set__(self, val): self.thisptr.kspace_encode_step_1 = val
+
+    property kspace_encode_step_2:
+        def __get__(self): return self.thisptr.kspace_encode_step_2
+        def __set__(self, val): self.thisptr.kspace_encode_step_2 = val
+
+    property average:
+        def __get__(self): return self.thisptr.average
+        def __set__(self, val): self.thisptr.average = val
+
+    property slice:
+        def __get__(self): return self.thisptr.slice
+        def __set__(self, val): self.thisptr.slice = val
+
+    property contrast:
+        def __get__(self): return self.thisptr.contrast
+        def __set__(self, val): self.thisptr.contrast = val
+
+    property phase:
+        def __get__(self): return self.thisptr.phase
+        def __set__(self, val): self.thisptr.phase = val
+
+    property repetition:
+        def __get__(self): return self.thisptr.repetition
+        def __set__(self, val): self.thisptr.repetition = val
+
+    property set:
+        def __get__(self): return self.thisptr.set
+        def __set__(self, val): self.thisptr.set = val
+
+    property segment:
+        def __get__(self): return self.thisptr.segment
+        def __set__(self, val): self.thisptr.segment = val
+
+    property user:
+        def __get__(self):
+            l = [0 for i in range(cismrmrd.ISMRMRD_USER_INTS)]
+            for i in range(cismrmrd.ISMRMRD_USER_INTS):
+                l[i] = self.thisptr.user[i]
+            return l
+        def __set__(self, vals):
+            for i in range(cismrmrd.ISMRMRD_USER_INTS):
+                self.thisptr.user[i] = vals[i]
+
 cdef class AcquisitionHeader:
     cdef cismrmrd.ISMRMRD_AcquisitionHeader *this
     def __cinit__(self):
@@ -19,6 +80,133 @@ cdef class AcquisitionHeader:
         def __get__(self): return self.this.version
         def __set__(self, val): self.this.version = val
 
+    property flags:
+        def __get__(self): return self.thisptr.flags
+        def __set__(self, val): self.thisptr.flags = val
+
+    property measurement_uid:
+        def __get__(self): return self.thisptr.measurement_uid
+        def __set__(self, val): self.thisptr.measurement_uid = val
+
+    property scan_counter:
+        def __get__(self): return self.thisptr.scan_counter
+        def __set__(self, val): self.thisptr.scan_counter = val
+
+    property acquisition_time_stamp:
+        def __get__(self): return self.thisptr.acquisition_time_stamp
+        def __set__(self, val): self.thisptr.acquisition_time_stamp = val
+
+    property physiology_time_stamp:
+        def __get__(self):
+            return [self.thisptr.physiology_time_stamp[i] for i in
+                    range(cismrmrd.ISMRMRD_PHYS_STAMPS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_PHYS_STAMPS):
+                self.thisptr.physiology_time_stamp[i] = val[i]
+
+    property number_of_samples:
+        def __get__(self): return self.thisptr.number_of_samples
+        def __set__(self, val): self.thisptr.number_of_samples = val
+
+    property available_channels:
+        def __get__(self): return self.thisptr.available_channels
+        def __set__(self, val): self.thisptr.available_channels = val
+
+    property active_channels:
+        def __get__(self): return self.thisptr.active_channels
+        def __set__(self, val): self.thisptr.active_channels = val
+
+    property channel_mask:
+        def __get__(self):
+            return [self.thisptr.channel_mask[i] for i in
+                    range(cismrmrd.ISMRMRD_CHANNEL_MASKS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_CHANNEL_MASKS):
+                self.thisptr.channel_mask[i] = val[i]
+
+    property discard_pre:
+        def __get__(self): return self.thisptr.discard_pre
+        def __set__(self, val): self.thisptr.discard_pre = val
+
+    property discard_post:
+        def __get__(self): return self.thisptr.discard_post
+        def __set__(self, val): self.thisptr.discard_post = val
+
+    property center_sample:
+        def __get__(self): return self.thisptr.center_sample
+        def __set__(self, val): self.thisptr.center_sample = val
+
+    property encoding_space_ref:
+        def __get__(self): return self.thisptr.encoding_space_ref
+        def __set__(self, val): self.thisptr.encoding_space_ref = val
+
+    property trajectory_dimensions:
+        def __get__(self): return self.thisptr.trajectory_dimensions
+        def __set__(self, val): self.thisptr.trajectory_dimensions = val
+
+    property sample_time_us:
+        def __get__(self): return self.thisptr.sample_time_us
+        def __set__(self, val): self.thisptr.sample_time_us = val
+
+    property position:
+        def __get__(self):
+            return [self.thisptr.position[i] for i in
+                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
+                self.thisptr.position[i] = val[i]
+
+    property read_dir:
+        def __get__(self):
+            return [self.thisptr.read_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.read_dir[i] = val[i]
+
+    property phase_dir:
+        def __get__(self):
+            return [self.thisptr.phase_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.phase_dir[i] = val[i]
+
+    property slice_dir:
+        def __get__(self):
+            return [self.thisptr.slice_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.slice_dir[i] = val[i]
+
+    property patient_table_position:
+        def __get__(self):
+            return [self.thisptr.patient_table_position[i] for i in
+                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
+                self.thisptr.patient_table_position[i] = val[i]
+
+    property idx:
+        def __get__(self): return self.idx
+        def __set__(self, val): pass    # FIXME (does nothing)
+
+    property user_int:
+        def __get__(self):
+            return [self.thisptr.user_int[i] for i in
+                    range(cismrmrd.ISMRMRD_USER_INTS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_USER_INTS):
+                self.thisptr.user_int[i] = val[i]
+
+    property user_float:
+        def __get__(self):
+            return [self.thisptr.user_float[i] for i in
+                    range(cismrmrd.ISMRMRD_USER_FLOATS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_USER_FLOATS):
+                self.thisptr.user_float[i] = val[i]
 
 cdef class Acquisition:
     cdef cismrmrd.ISMRMRD_Acquisition *this
@@ -32,9 +220,168 @@ cdef class Acquisition:
     property data:
         def __get__(self):
             size = cismrmrd.ismrmrd_size_of_acquisition_data(self.this)
-            # arr = np.zeros(size, dtype=np.cfloat)
-            cdef complex float [:] arrview = self.this.data
-            return arrview
+            return None     # FIXME: return NumPy array or Cython Typed MemoryView
+
+cdef class ImageHeader:
+    cdef cismrmrd.ISMRMRD_ImageHeader *this
+    def __cinit__(self):
+        self.this = <cismrmrd.ISMRMRD_ImageHeader*>calloc(1, sizeof(cismrmrd.ISMRMRD_ImageHeader))
+    def __dealloc__(self):
+        free(self.this)
+
+    property version:
+        def __get__(self): return self.thisptr.version
+        def __set__(self, val): self.thisptr.version = val
+
+    property flags:
+        def __get__(self): return self.thisptr.flags
+        def __set__(self, val): self.thisptr.flags = val
+
+    property measurement_uid:
+        def __get__(self): return self.thisptr.measurement_uid
+        def __set__(self, val): self.thisptr.measurement_uid = val
+
+    property matrix_size:
+        def __get__(self):
+            return [self.thisptr.matrix_size[i] for i in range(3)]
+        def __set__(self, val):
+            for i in range(3):
+                self.thisptr.matrix_size[i] = val[i]
+
+    property field_of_view:
+        def __get__(self):
+            return [self.thisptr.field_of_view[i] for i in range(3)]
+        def __set__(self, val):
+            for i in range(3):
+                self.thisptr.field_of_view[i] = val[i]
+
+    property channels:
+        def __get__(self): return self.thisptr.channels
+        def __set__(self, val): self.thisptr.channels = val
+
+    property position:
+        def __get__(self):
+            return [self.thisptr.position[i] for i in
+                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
+                self.thisptr.position[i] = val[i]
+
+    property read_dir:
+        def __get__(self):
+            return [self.thisptr.read_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.read_dir[i] = val[i]
+
+    property phase_dir:
+        def __get__(self):
+            return [self.thisptr.phase_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.phase_dir[i] = val[i]
+
+    property slice_dir:
+        def __get__(self):
+            return [self.thisptr.slice_dir[i] for i in
+                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
+                self.thisptr.slice_dir[i] = val[i]
+
+    property patient_table_position:
+        def __get__(self):
+            return [self.thisptr.patient_table_position[i] for i in
+                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
+                self.thisptr.patient_table_position[i] = val[i]
+
+    property average:
+        def __get__(self): return self.thisptr.average
+        def __set__(self, val): self.thisptr.average = val
+
+    property slice:
+        def __get__(self): return self.thisptr.slice
+        def __set__(self, val): self.thisptr.slice = val
+
+    property contrast:
+        def __get__(self): return self.thisptr.contrast
+        def __set__(self, val): self.thisptr.contrast = val
+
+    property phase:
+        def __get__(self): return self.thisptr.phase
+        def __set__(self, val): self.thisptr.phase = val
+
+    property repetition:
+        def __get__(self): return self.thisptr.repetition
+        def __set__(self, val): self.thisptr.repetition = val
+
+    property set:
+        def __get__(self): return self.thisptr.set
+        def __set__(self, val): self.thisptr.set = val
+
+    property acquisition_time_stamp:
+        def __get__(self): return self.thisptr.acquisition_time_stamp
+        def __set__(self, val): self.thisptr.acquisition_time_stamp = val
+
+    property physiology_time_stamp:
+        def __get__(self):
+            return [self.thisptr.physiology_time_stamp[i] for i in
+                    range(cismrmrd.ISMRMRD_PHYS_STAMPS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_PHYS_STAMPS):
+                self.thisptr.physiology_time_stamp[i] = val[i]
+
+    property image_data_type:
+        def __get__(self): return self.thisptr.image_data_type
+        def __set__(self, val): self.thisptr.image_data_type = val
+
+    property image_type:
+        def __get__(self): return self.thisptr.image_type
+        def __set__(self, val): self.thisptr.image_type = val
+
+    property image_index:
+        def __get__(self): return self.thisptr.image_index
+        def __set__(self, val): self.thisptr.image_index = val
+
+    property image_series_index:
+        def __get__(self): return self.thisptr.image_series_index
+        def __set__(self, val): self.thisptr.image_series_index = val
+
+    property user_int:
+        def __get__(self):
+            return [self.thisptr.user_int[i] for i in
+                    range(cismrmrd.ISMRMRD_USER_INTS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_USER_INTS):
+                self.thisptr.user_int[i] = val[i]
+
+    property user_float:
+        def __get__(self):
+            return [self.thisptr.user_float[i] for i in
+                    range(cismrmrd.ISMRMRD_USER_FLOATS)]
+        def __set__(self, val):
+            for i in range(cismrmrd.ISMRMRD_USER_FLOATS):
+                self.thisptr.user_int[i] = val[i]
+
+cdef class Image:
+    cdef cismrmrd.ISMRMRD_Image *this
+    def __cinit__(self):
+        self.this = <cismrmrd.ISMRMRD_Image*>cismrmrd.ismrmrd_create_image()
+    def __dealloc__(self):
+        cismrmrd.ismrmrd_free_image(self.this)
+
+    property head:
+        def __get__(self): return ImageHeader_from_struct(&self.this.head)
+    property attribute_string:
+        def __get__(self): return self.this.attribute_string
+    property data:
+        def __get__(self):
+            size = cismrmrd.ismrmrd_size_of_image_data(self.this)
+            return None     # FIXME: return NumPy array or Cython Typed MemoryView
 
 cdef class Dataset:
     cdef cismrmrd.ISMRMRD_Dataset *this
diff --git a/bindings/python/ismrmrd.pyx.bak b/bindings/python/ismrmrd.pyx.bak
deleted file mode 100644
index 8cfc8c3..0000000
--- a/bindings/python/ismrmrd.pyx.bak
+++ /dev/null
@@ -1,348 +0,0 @@
-cimport cismrmrd
-
-cdef class PyEncodingCounters:
-    cdef cismrmrd.EncodingCounters *thisptr
-    def __cinit__(self):
-        self.thisptr = cismrmrd.EncodingCounters_new()
-
-    def __dealloc__(self):
-        cismrmrd.EncodingCounters_free(self.thisptr)
-
-    property kspace_encode_step_1:
-        def __get__(self): return self.thisptr.kspace_encode_step_1
-        def __set__(self, val): self.thisptr.kspace_encode_step_1 = val
-
-    property kspace_encode_step_2:
-        def __get__(self): return self.thisptr.kspace_encode_step_2
-        def __set__(self, val): self.thisptr.kspace_encode_step_2 = val
-
-    property average:
-        def __get__(self): return self.thisptr.average
-        def __set__(self, val): self.thisptr.average = val
-
-    property slice:
-        def __get__(self): return self.thisptr.slice
-        def __set__(self, val): self.thisptr.slice = val
-
-    property contrast:
-        def __get__(self): return self.thisptr.contrast
-        def __set__(self, val): self.thisptr.contrast = val
-
-    property phase:
-        def __get__(self): return self.thisptr.phase
-        def __set__(self, val): self.thisptr.phase = val
-
-    property repetition:
-        def __get__(self): return self.thisptr.repetition
-        def __set__(self, val): self.thisptr.repetition = val
-
-    property set:
-        def __get__(self): return self.thisptr.set
-        def __set__(self, val): self.thisptr.set = val
-
-    property segment:
-        def __get__(self): return self.thisptr.segment
-        def __set__(self, val): self.thisptr.segment = val
-
-    property user:
-        def __get__(self):
-            l = [0 for i in range(cismrmrd.ISMRMRD_USER_INTS)]
-            for i in range(cismrmrd.ISMRMRD_USER_INTS):
-                l[i] = self.thisptr.user[i]
-            return l
-        def __set__(self, vals):
-            for i in range(cismrmrd.ISMRMRD_USER_INTS):
-                self.thisptr.user[i] = vals[i]
-
-
-cdef class PyAcquisitionHeader:
-    cdef cismrmrd.AcquisitionHeader *thisptr
-    cdef PyEncodingCounters idx
-
-    def __cinit__(self):
-        self.thisptr = cismrmrd.AcquisitionHeader_new()
-
-    def __init__(self):
-        self.idx = PyEncodingCounters()
-
-    def __dealloc__(self):
-        cismrmrd.AcquisitionHeader_free(self.thisptr)
-
-    property version:
-        def __get__(self): return self.thisptr.version
-        def __set__(self, val): self.thisptr.version = val
-
-    property flags:
-        def __get__(self): return self.thisptr.flags
-        def __set__(self, val): self.thisptr.flags = val
-
-    property measurement_uid:
-        def __get__(self): return self.thisptr.measurement_uid
-        def __set__(self, val): self.thisptr.measurement_uid = val
-
-    property scan_counter:
-        def __get__(self): return self.thisptr.scan_counter
-        def __set__(self, val): self.thisptr.scan_counter = val
-
-    property acquisition_time_stamp:
-        def __get__(self): return self.thisptr.acquisition_time_stamp
-        def __set__(self, val): self.thisptr.acquisition_time_stamp = val
-
-    property physiology_time_stamp:
-        def __get__(self):
-            return [self.thisptr.physiology_time_stamp[i] for i in
-                    range(cismrmrd.ISMRMRD_PHYS_STAMPS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_PHYS_STAMPS):
-                self.thisptr.physiology_time_stamp[i] = val[i]
-
-    property number_of_samples:
-        def __get__(self): return self.thisptr.number_of_samples
-        def __set__(self, val): self.thisptr.number_of_samples = val
-
-    property available_channels:
-        def __get__(self): return self.thisptr.available_channels
-        def __set__(self, val): self.thisptr.available_channels = val
-
-    property active_channels:
-        def __get__(self): return self.thisptr.active_channels
-        def __set__(self, val): self.thisptr.active_channels = val
-
-    property channel_mask:
-        def __get__(self):
-            return [self.thisptr.channel_mask[i] for i in
-                    range(cismrmrd.ISMRMRD_CHANNEL_MASKS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_CHANNEL_MASKS):
-                self.thisptr.channel_mask[i] = val[i]
-
-    property discard_pre:
-        def __get__(self): return self.thisptr.discard_pre
-        def __set__(self, val): self.thisptr.discard_pre = val
-
-    property discard_post:
-        def __get__(self): return self.thisptr.discard_post
-        def __set__(self, val): self.thisptr.discard_post = val
-
-    property center_sample:
-        def __get__(self): return self.thisptr.center_sample
-        def __set__(self, val): self.thisptr.center_sample = val
-
-    property encoding_space_ref:
-        def __get__(self): return self.thisptr.encoding_space_ref
-        def __set__(self, val): self.thisptr.encoding_space_ref = val
-
-    property trajectory_dimensions:
-        def __get__(self): return self.thisptr.trajectory_dimensions
-        def __set__(self, val): self.thisptr.trajectory_dimensions = val
-
-    property sample_time_us:
-        def __get__(self): return self.thisptr.sample_time_us
-        def __set__(self, val): self.thisptr.sample_time_us = val
-
-    property position:
-        def __get__(self):
-            return [self.thisptr.position[i] for i in
-                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
-                self.thisptr.position[i] = val[i]
-
-    property read_dir:
-        def __get__(self):
-            return [self.thisptr.read_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.read_dir[i] = val[i]
-
-    property phase_dir:
-        def __get__(self):
-            return [self.thisptr.phase_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.phase_dir[i] = val[i]
-
-    property slice_dir:
-        def __get__(self):
-            return [self.thisptr.slice_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.slice_dir[i] = val[i]
-
-    property patient_table_position:
-        def __get__(self):
-            return [self.thisptr.patient_table_position[i] for i in
-                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
-                self.thisptr.patient_table_position[i] = val[i]
-
-    property idx:
-        def __get__(self): return self.idx
-        def __set__(self, val): pass    # FIXME (does nothing)
-
-    property user_int:
-        def __get__(self):
-            return [self.thisptr.user_int[i] for i in
-                    range(cismrmrd.ISMRMRD_USER_INTS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_USER_INTS):
-                self.thisptr.user_int[i] = val[i]
-
-    property user_float:
-        def __get__(self):
-            return [self.thisptr.user_float[i] for i in
-                    range(cismrmrd.ISMRMRD_USER_FLOATS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_USER_FLOATS):
-                self.thisptr.user_float[i] = val[i]
-
-
-cdef class PyImageHeader:
-    cdef cismrmrd.ImageHeader *thisptr
-    def __cinit__(self):
-        self.thisptr = cismrmrd.ImageHeader_new()
-
-    def __dealloc__(self):
-        cismrmrd.ImageHeader_free(self.thisptr)
-
-    property version:
-        def __get__(self): return self.thisptr.version
-        def __set__(self, val): self.thisptr.version = val
-
-    property flags:
-        def __get__(self): return self.thisptr.flags
-        def __set__(self, val): self.thisptr.flags = val
-
-    property measurement_uid:
-        def __get__(self): return self.thisptr.measurement_uid
-        def __set__(self, val): self.thisptr.measurement_uid = val
-
-    property matrix_size:
-        def __get__(self):
-            return [self.thisptr.matrix_size[i] for i in range(3)]
-        def __set__(self, val):
-            for i in range(3):
-                self.thisptr.matrix_size[i] = val[i]
-
-    property field_of_view:
-        def __get__(self):
-            return [self.thisptr.field_of_view[i] for i in range(3)]
-        def __set__(self, val):
-            for i in range(3):
-                self.thisptr.field_of_view[i] = val[i]
-
-    property channels:
-        def __get__(self): return self.thisptr.channels
-        def __set__(self, val): self.thisptr.channels = val
-
-    property position:
-        def __get__(self):
-            return [self.thisptr.position[i] for i in
-                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
-                self.thisptr.position[i] = val[i]
-
-    property read_dir:
-        def __get__(self):
-            return [self.thisptr.read_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.read_dir[i] = val[i]
-
-    property phase_dir:
-        def __get__(self):
-            return [self.thisptr.phase_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.phase_dir[i] = val[i]
-
-    property slice_dir:
-        def __get__(self):
-            return [self.thisptr.slice_dir[i] for i in
-                    range(cismrmrd.ISMRMRD_DIRECTION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_DIRECTION_LENGTH):
-                self.thisptr.slice_dir[i] = val[i]
-
-    property patient_table_position:
-        def __get__(self):
-            return [self.thisptr.patient_table_position[i] for i in
-                    range(cismrmrd.ISMRMRD_POSITION_LENGTH)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_POSITION_LENGTH):
-                self.thisptr.patient_table_position[i] = val[i]
-
-    property average:
-        def __get__(self): return self.thisptr.average
-        def __set__(self, val): self.thisptr.average = val
-
-    property slice:
-        def __get__(self): return self.thisptr.slice
-        def __set__(self, val): self.thisptr.slice = val
-
-    property contrast:
-        def __get__(self): return self.thisptr.contrast
-        def __set__(self, val): self.thisptr.contrast = val
-
-    property phase:
-        def __get__(self): return self.thisptr.phase
-        def __set__(self, val): self.thisptr.phase = val
-
-    property repetition:
-        def __get__(self): return self.thisptr.repetition
-        def __set__(self, val): self.thisptr.repetition = val
-
-    property set:
-        def __get__(self): return self.thisptr.set
-        def __set__(self, val): self.thisptr.set = val
-
-    property acquisition_time_stamp:
-        def __get__(self): return self.thisptr.acquisition_time_stamp
-        def __set__(self, val): self.thisptr.acquisition_time_stamp = val
-
-    property physiology_time_stamp:
-        def __get__(self):
-            return [self.thisptr.physiology_time_stamp[i] for i in
-                    range(cismrmrd.ISMRMRD_PHYS_STAMPS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_PHYS_STAMPS):
-                self.thisptr.physiology_time_stamp[i] = val[i]
-
-    property image_data_type:
-        def __get__(self): return self.thisptr.image_data_type
-        def __set__(self, val): self.thisptr.image_data_type = val
-
-    property image_type:
-        def __get__(self): return self.thisptr.image_type
-        def __set__(self, val): self.thisptr.image_type = val
-
-    property image_index:
-        def __get__(self): return self.thisptr.image_index
-        def __set__(self, val): self.thisptr.image_index = val
-
-    property image_series_index:
-        def __get__(self): return self.thisptr.image_series_index
-        def __set__(self, val): self.thisptr.image_series_index = val
-
-    property user_int:
-        def __get__(self):
-            return [self.thisptr.user_int[i] for i in
-                    range(cismrmrd.ISMRMRD_USER_INTS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_USER_INTS):
-                self.thisptr.user_int[i] = val[i]
-
-    property user_float:
-        def __get__(self):
-            return [self.thisptr.user_float[i] for i in
-                    range(cismrmrd.ISMRMRD_USER_FLOATS)]
-        def __set__(self, val):
-            for i in range(cismrmrd.ISMRMRD_USER_FLOATS):
-                self.thisptr.user_int[i] = val[i]
diff --git a/bindings/python/test.py b/bindings/python/test.py
deleted file mode 100644
index 9203170..0000000
--- a/bindings/python/test.py
+++ /dev/null
@@ -1,13 +0,0 @@
-import ismrmrd
-
-acq = ismrmrd.Acquisition()
-# acq.version = 42
-
-f = ismrmrd.Dataset('./testdata.h5', '/dataset', True)
-print f.filename
-# xml = f.readHeader()
-
-# a = f.readAcquisition(10)
-
-# print(a.getPosition(0), a.getPosition(1), a.getPosition(2))
-# print(a.getReadDirection(0), a.getReadDirection(1), a.getReadDirection(2))
diff --git a/bindings/python/usage.py b/bindings/python/usage.py
deleted file mode 100644
index a8dc614..0000000
--- a/bindings/python/usage.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import h5py
-
-HEADER_PATH = 'xml'
-DATA_PATH = 'data'
-
-class IsmrmrdDataset(object):
-    def __init__(self, filename, dataset):
-        self.filename = filename
-        self.dsetname = dataset
-        self.h5file = None
-        self.h5dset = None
-
-    def load(self):
-        self.h5file = h5py.File(self.filename)
-        self.h5dset = self.filename[self.dsetname]
-
-        a = self.h5dset[HEADER_PATH].value
-        self.header = str(a[0])
-
-    def append_array(self, array, name):
-        self.h5dset[name] = array
-
-    def read_array(self, name, index):
-        return self.h5dset[name]
-
-    def append_acquisition(Acquisition)

-- 
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