[ismrmrd] 175/281: Continuing to work on matlab interace.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:01:11 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 4daeaf6e102a71d438293f9d97b2e3845486579d
Author: Souheil Inati <souheil.inati at nih.gov>
Date: Thu Aug 29 09:16:47 2013 -0400
Continuing to work on matlab interace.
---
matlab/+ismrmrd/IsmrmrdDataset.m | 10 +++++++---
matlab/+ismrmrd/XMLHeader.m | 33 ---------------------------------
matlab/+ismrmrd/hdf5_datatypes.m | 37 +++++++++++++++++++++++++++++++++----
matlab/+ismrmrd/{old => }/isInt.m | 0
4 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/matlab/+ismrmrd/IsmrmrdDataset.m b/matlab/+ismrmrd/IsmrmrdDataset.m
index c3e0f5b..68fa01e 100644
--- a/matlab/+ismrmrd/IsmrmrdDataset.m
+++ b/matlab/+ismrmrd/IsmrmrdDataset.m
@@ -6,12 +6,16 @@ classdef IsmrmrdDataset
datapath = '';
xmlpath = '';
xmlhdr = [];
+ htypes = [];
end
methods
function obj = IsmrmrdDataset(filename,groupname)
+ % Set the hdf types
+ obj.htypes = ismrmrd.hdf5_datatypes;
+
% If the file exists, open it for read/write
% otherwise, create it
if exist(filename,'file')
@@ -164,7 +168,7 @@ classdef IsmrmrdDataset
% Read the desired acquisition
offset = [nacq-1 0];
H5S.select_hyperslab(file_space_id,'H5S_SELECT_SET',offset,[1 1],[1 1],[1 1]);
- d = H5D.read(dset_id, ismrmrd.hdf5_datatypes.getType_Acquisition, ...
+ d = H5D.read(dset_id, obj.htypes.T_Acquisition, ...
mem_space_id, file_space_id, 'H5P_DEFAULT');
% Set the structure bits
@@ -199,7 +203,7 @@ classdef IsmrmrdDataset
chunk = [1 1];
H5P.set_chunk (dcpl, chunk);
data_id = H5D.create(obj.fid, obj.datapath, ...
- ismrmrd.hdf5_datatypes.getType_Acquisition, ...
+ obj.htypes.T_Acquisition, ...
file_space_id, dcpl);
H5P.close(dcpl);
H5S.close(file_space_id);
@@ -245,7 +249,7 @@ classdef IsmrmrdDataset
d.data{1} = t;
% Write
- H5D.write(data_id, ismrmrd.hdf5_datatypes.getType_Acquisition(), ...
+ H5D.write(data_id, obj.htypes.T_Acquisition, ...
mem_space_id, file_space_id, 'H5P_DEFAULT', d);
% Clean up
diff --git a/matlab/+ismrmrd/XMLHeader.m b/matlab/+ismrmrd/XMLHeader.m
deleted file mode 100644
index eca3ebc..0000000
--- a/matlab/+ismrmrd/XMLHeader.m
+++ /dev/null
@@ -1,33 +0,0 @@
-classdef XMLHeader
-
- methods
-
- function obj = XMLHeader(xmlstr)
-
- obj.factory = org.ismrm.ismrmrd.xmlhdr.ObjectFactory();
- end
-
- function hdr = fromString(obj,xmlstring)
- import javax.xml.bind.*
- jc = JAXBContext.newInstance('org.ismrm.ismrmrd.xmlhdr', obj.factory.getClass().getClassLoader());
- u = jc.createUnmarshaller();
- jstr = java.lang.String(xmlstring);
- hdr = u.unmarshal(java.io.ByteArrayInputStream(jstr.getBytes()));
-
- end
-
- function xmlstring = toString(obj)
- import javax.xml.bind.*
- jc = JAXBContext.newInstance('org.ismrm.ismrmrd.xmlhdr', obj.factory.getClass().getClassLoader());
- m = jc.createMarshaller();
- m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, 'http://www.ismrm.org/ISMRMD ismrmrd.xsd');
-
- strbuff = java.io.StringWriter();
- m.marshal(hdr, strbuff);
- xmlstring = strbuff.toString();
-
- end
-
- end
-
-end
diff --git a/matlab/+ismrmrd/hdf5_datatypes.m b/matlab/+ismrmrd/hdf5_datatypes.m
index 7d767ad..ccd9a8a 100644
--- a/matlab/+ismrmrd/hdf5_datatypes.m
+++ b/matlab/+ismrmrd/hdf5_datatypes.m
@@ -1,5 +1,34 @@
classdef hdf5_datatypes
-
+% This convenience class defines the HDF5 types used in the
+% ISMRMRD HDF5 file
+ properties
+ T_float;
+ T_double;
+ T_char;
+ T_complexfloat;
+ T_complexdouble;
+ T_ushort;
+ T_EncodingCounters;
+ T_AcquisitionHeader;
+ T_Acquisition;
+ end
+
+ methods
+
+ function obj = hdf5_datatypes()
+ obj.T_float = obj.getType_float();
+ obj.T_double = obj.getType_double();
+ obj.T_char = obj.getType_char();
+ obj.T_complexfloat = obj.getType_complexfloat();
+ obj.T_complexdouble = obj.getType_complexdouble();
+ obj.T_ushort = obj.getType_ushort();
+ obj.T_EncodingCounters = obj.getType_EncodingCounters();
+ obj.T_AcquisitionHeader = obj.getType_AcquisitionHeader();
+ obj.T_Acquisition = obj.getType_Acquisition();
+ end
+
+ end
+
methods (Static)
function b = getType_float()
@@ -77,7 +106,7 @@ classdef hdf5_datatypes
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT32'); % measurement_uid
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT32'); % scan_counter
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT32'); % acquisition_time_stamp
- typesize = typesize + 8*H5T.get_size('H5T_NATIVE_UINT32'); % physio_time_stamps
+ typesize = typesize + 3*H5T.get_size('H5T_NATIVE_UINT32'); % physio_time_stamps
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT16'); % number_of_samples
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT16'); % available_channels
typesize = typesize + H5T.get_size('H5T_NATIVE_UINT16'); % active_channels
@@ -115,8 +144,8 @@ classdef hdf5_datatypes
H5T.insert(b, 'acquisition_time_stamp', offset, 'H5T_NATIVE_UINT32');
offset = offset + H5T.get_size('H5T_NATIVE_UINT32');
- H5T.insert(b, 'physiology_time_stamp', offset, H5T.array_create('H5T_NATIVE_UINT32',[8]));
- offset = offset + 8*H5T.get_size('H5T_NATIVE_UINT32');
+ H5T.insert(b, 'physiology_time_stamp', offset, H5T.array_create('H5T_NATIVE_UINT32',[3]));
+ offset = offset + 3*H5T.get_size('H5T_NATIVE_UINT32');
H5T.insert(b, 'number_of_samples', offset, 'H5T_NATIVE_UINT16');
offset = offset + H5T.get_size('H5T_NATIVE_UINT16');
diff --git a/matlab/+ismrmrd/old/isInt.m b/matlab/+ismrmrd/isInt.m
similarity index 100%
rename from matlab/+ismrmrd/old/isInt.m
rename to matlab/+ismrmrd/isInt.m
--
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