[ismrmrd] 39/281: Most of the data structures are complete. Starting to make progress on the HDF5 low level read/write routines.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:00:53 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 b2de9382cfb959a1f65afb0a2d5a8b076761e666
Author: Souheil Inati <souheil.inati at nih.gov>
Date: Fri Sep 7 16:40:39 2012 -0400
Most of the data structures are complete. Starting to make progress on the HDF5 low level read/write routines.
---
matlab/+ismrmrd/Acquisition.m | 40 ++++++++++++
matlab/+ismrmrd/Image.m | 35 ++++++++++
matlab/+ismrmrd/ImageHeader.m | 148 ++++++++++++++++++++++++++++++++++++++++++
matlab/testread.m | 37 +++++++++++
4 files changed, 260 insertions(+)
diff --git a/matlab/+ismrmrd/Acquisition.m b/matlab/+ismrmrd/Acquisition.m
new file mode 100644
index 0000000..697f437
--- /dev/null
+++ b/matlab/+ismrmrd/Acquisition.m
@@ -0,0 +1,40 @@
+% Acquisition
+classdef Acquisition
+
+ % Properties
+ properties
+
+ head_ = ismrmrd.AcquisitionHeader;
+ traj_ = [];
+ data_ = [];
+
+ end % Properties
+
+ % Methods
+ methods
+
+ function obj = set.head_(obj,v)
+ obj.head_ = v;
+ end
+
+ function obj = set.traj_(obj,v)
+ obj.traj_ = single(v);
+ end
+
+ function obj = set.data_(obj,v)
+ obj.data_ = single(complex(v));
+ end
+
+ function b = isFlagSet(obj,flag)
+ bitflag = ismrmrd.FlagBit(flag);
+ b = bitflag.isSet(obj.head_.flag);
+ end
+
+ function obj = setFlag(obj,flag)
+ bitflag = ismrmrd.FlagBit(flag);
+ obj.head_.flag = bitor(obj.head_.flag, bitflag.bitmask_);
+ end
+
+ end % Methods
+
+end
\ No newline at end of file
diff --git a/matlab/+ismrmrd/Image.m b/matlab/+ismrmrd/Image.m
new file mode 100644
index 0000000..fe591b8
--- /dev/null
+++ b/matlab/+ismrmrd/Image.m
@@ -0,0 +1,35 @@
+% Image
+classdef Image
+
+ % Properties
+ properties
+
+ head_ = ismrmrd.ImageHeader;
+ data_ = [];
+
+ end % Properties
+
+ % Methods
+ methods
+
+ function obj = set.head_(obj,v)
+ obj.head_ = v;
+ end
+
+ function obj = set.data_(obj,v)
+ obj.data_ = single(complex(v));
+ end
+
+ function b = isFlagSet(obj,flag)
+ bitflag = ismrmrd.FlagBit(flag);
+ b = bitflag.isSet(obj.head_.flag);
+ end
+
+ function obj = setFlag(obj,flag)
+ bitflag = ismrmrd.FlagBit(flag);
+ obj.head_.flag = bitor(obj.head_.flag, bitflag.bitmask_);
+ end
+
+ end % Methods
+
+end
\ No newline at end of file
diff --git a/matlab/+ismrmrd/ImageHeader.m b/matlab/+ismrmrd/ImageHeader.m
new file mode 100644
index 0000000..6d1558e
--- /dev/null
+++ b/matlab/+ismrmrd/ImageHeader.m
@@ -0,0 +1,148 @@
+classdef ImageHeader
+
+ properties
+ version = uint16(0); % First unsigned int indicates the version %
+ flag = uint64(0); % bit field with flags %
+ measurement_uid = uint32(0); % Unique ID for the measurement %
+ matrix_size = zeros(3,1,'uint16'); % Pixels in the 3 spatial dimensions
+ field_of_view = zeros(3,1,'single'); % Size (in mm) of the 3 spatial dimensions %
+ channels = uint16(0); % Number of receive channels %
+ position = zeros(3,1,'single'); % Three-dimensional spatial offsets from isocenter %
+ quaternion = zeros(4,1,'single'); % Angulation of acquisition %
+ patient_table_position = zeros(3,1,'single'); % Patient table off-center %
+ average = uint16(0); % e.g. signal average number %
+ slice = uint16(0); % e.g. imaging slice number %
+ contrast = uint16(0); % e.g. echo number in multi-echo %
+ phase = uint16(0); % e.g. cardiac phase number %
+ repetition = uint16(0); % e.g. dynamic number for dynamic scanning %
+ set = uint16(0); % e.g. flow encodning set %
+ acquisition_time_stamp = uint32(0); % Acquisition clock %
+ physiology_time_stamp = zeros(3,1,'uint32'); % Physiology time stamps, e.g. ecg, breating, etc. %
+ image_data_type = uint16(0); % e.g. unsigned short, float, complex float, etc. %
+ image_type = uint16(0); % e.g. magnitude, phase, complex, real, imag, etc. %
+ image_index = uint16(0); % e.g. image number in series of images %
+ image_series_index = uint16(0); % e.g. series number %
+ user_int = zeros(8,1,'int32'); % Free user parameters %
+ user_float = zeros(8,1,'single'); % Free user parameters %
+ end
+
+ methods
+
+ function obj = set.version(obj,v)
+ obj.version = uint16(v);
+ end
+
+ function obj = set.flag(obj,v)
+ obj.flag = uint64(v);
+ end
+
+ function obj = set.measurement_uid(obj,v)
+ obj.measurement_uid = uint32(v);
+ end
+
+ function obj = set.matrix_size(obj,v)
+ if (length(v)~=3)
+ error('ImageHeader.matrix_size must have 3 elements')
+ end
+ obj.matrix_size = uint16(v);
+ end
+
+ function obj = set.field_of_view(obj,v)
+ if (length(v)~=3)
+ error('ImageHeader.field_of_view must have 3 elements')
+ end
+ obj.field_of_view = single(v);
+ end
+
+ function obj = set.channels(obj,v)
+ obj.channels = uint16(v);
+ end
+
+ function obj = set.position(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.position must have 3 elements')
+ end
+ obj.position = single(v);
+ end
+
+ function obj = set.quaternion(obj,v)
+ if (length(v)~=4)
+ error('AcquisitionHeader.quaternion must have 4 elements')
+ end
+ obj.quaternion = single(v);
+ end
+
+ function obj = set.patient_table_position(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.patient_table_position must have 3 elements')
+ end
+ obj.patient_table_position = single(v);
+ end
+
+ function obj = set.average(obj,v)
+ obj.average = uint16(v);
+ end
+
+ function obj = set.slice(obj,v)
+ obj.slice = uint16(v);
+ end
+
+ function obj = set.contrast(obj,v)
+ obj.contrast = uint16(v);
+ end
+
+ function obj = set.phase(obj,v)
+ obj.phase = uint16(v);
+ end
+
+ function obj = set.repetition(obj,v)
+ obj.repetition = uint16(v);
+ end
+
+ function obj = set.set(obj,v)
+ obj.set = uint16(v);
+ end
+
+ function obj = set.acquisition_time_stamp(obj,v)
+ obj.acquisition_time_stamp = uint32(v);
+ end
+
+ function obj = set.physiology_time_stamp(obj,v)
+ if (length(v)~=3)
+ error('AcquisitionHeader.physiology_time_stamp must have 3 elements')
+ end
+ obj.physiology_time_stamp = uint32(v);
+ end
+
+ function obj = set.image_data_type(obj,v)
+ obj.image_data_type = uint16(v);
+ end
+
+ function obj = set.image_type(obj,v)
+ obj.image_type = uint16(v);
+ end
+
+ function obj = set.image_index(obj,v)
+ obj.image_index = uint16(v);
+ end
+ function obj = set.image_series_index(obj,v)
+ obj.image_series_index = uint16(v);
+ end
+
+ function obj = set.user_int(obj,v)
+ if (length(v)~=8)
+ error('AcquisitionHeader.user_int must have 8 elements')
+ end
+ obj.user_int = int32(v);
+ end
+
+ function obj = set.user_float(obj,v)
+ if (length(v)~=8)
+ error('AcquisitionHeader.user_float must have 8 elements')
+ end
+ obj.user_float = single(v);
+ end
+
+ end
+
+end
diff --git a/matlab/testread.m b/matlab/testread.m
new file mode 100644
index 0000000..b6c9590
--- /dev/null
+++ b/matlab/testread.m
@@ -0,0 +1,37 @@
+filename = 'simple_gre.h5';
+
+% Open the HDF5 File
+file = H5F.open(filename, 'H5F_ACC_RDONLY', 'H5P_DEFAULT');
+
+% Open the xml
+dset = H5D.open(file, '/dataset/xml');
+
+% Get the dataspace
+space = H5D.get_space(dset);
+
+% Set variable length string type
+ismrm.datatypes.xmlhead = H5T.copy('H5T_C_S1');
+H5T.set_size(ismrm.datatypes.xmlhead,'H5T_VARIABLE');
+
+% Read the data
+xmldata = H5D.read(dset, ismrm.datatypes.xmlhead, 'H5S_ALL', 'H5S_ALL', 'H5P_DEFAULT');
+
+% Close the XML Header
+H5D.close (dset);
+H5S.close (space);
+
+% Open the data
+dset = H5D.open(file, '/dataset/data');
+space = H5D.get_space(dset);
+H5S.get_simple_extent_dims(space);
+[~,dims,~] = H5S.get_simple_extent_dims(space);
+nacq = dims(1);
+
+% Close the data
+%H5D.close (dset);
+%H5S.close (space);
+
+% Close the file
+%H5F.close (file)
+
+%H5T.close (memtype);
--
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