[ismrmrd] 35/281: Initial work on the matlab wrappers.
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 6a608c9e5324225bcbc55f76921834a374b65caa
Author: Souheil Inati <souheil.inati at nih.gov>
Date: Thu Sep 6 16:49:39 2012 -0400
Initial work on the matlab wrappers.
---
matlab/+ismrmrd/AcquisitionFlags.m | 38 ++++++++++
matlab/+ismrmrd/AcquisitionHeader.m | 136 ++++++++++++++++++++++++++++++++++++
matlab/+ismrmrd/EncodingCounters.m | 61 ++++++++++++++++
matlab/+ismrmrd/FlagBit.m | 31 ++++++++
matlab/+ismrmrd/ImageDataType.m | 9 +++
matlab/+ismrmrd/ImageFlags.m | 14 ++++
matlab/+ismrmrd/ImageType.m | 9 +++
matlab/+ismrmrd/isInt.m | 5 ++
8 files changed, 303 insertions(+)
diff --git a/matlab/+ismrmrd/AcquisitionFlags.m b/matlab/+ismrmrd/AcquisitionFlags.m
new file mode 100644
index 0000000..f8ea364
--- /dev/null
+++ b/matlab/+ismrmrd/AcquisitionFlags.m
@@ -0,0 +1,38 @@
+classdef AcquisitionFlags
+ properties(Constant)
+ % Looping indicators %
+ ACQ_FIRST_IN_ENCODE_STEP1 = 1,
+ ACQ_LAST_IN_ENCODE_STEP1 = 2,
+ ACQ_FIRST_IN_ENCODE_STEP2 = 3,
+ ACQ_LAST_IN_ENCODE_STEP2 = 4,
+ ACQ_FIRST_IN_AVERAGE = 5,
+ ACQ_LAST_IN_AVERAGE = 6,
+ ACQ_FIRST_IN_SLICE = 7,
+ ACQ_LAST_IN_SLICE = 8,
+ ACQ_FIRST_IN_CONTRAST = 9,
+ ACQ_LAST_IN_CONTRAST = 10,
+ ACQ_FIRST_IN_PHASE = 11,
+ ACQ_LAST_IN_PHASE = 12,
+ ACQ_FIRST_IN_REPETITION = 13,
+ ACQ_LAST_IN_REPETITION = 14,
+ ACQ_FIRST_IN_SET = 15,
+ ACQ_LAST_IN_SET = 16,
+ ACQ_FIRST_IN_SEGMENT = 17,
+ ACQ_LAST_IN_SEGMENT = 18,
+
+ ACQ_IS_NOISE_MEASUREMENT = 19,
+ ACQ_IS_PARALLEL_CALIBRATION = 20,
+ ACQ_IS_PARALLEL_CALIBRATION_AND_IMAGING = 21,
+ ACQ_IS_REVERSE = 22,
+ ACQ_IS_NAVIGATION_DATA = 23,
+
+ ACQ_USER1 = 57,
+ ACQ_USER2 = 58,
+ ACQ_USER3 = 59,
+ ACQ_USER4 = 60,
+ ACQ_USER5 = 61,
+ ACQ_USER6 = 62,
+ ACQ_USER7 = 63,
+ ACQ_USER8 = 64
+ end
+end
\ No newline at end of file
diff --git a/matlab/+ismrmrd/AcquisitionHeader.m b/matlab/+ismrmrd/AcquisitionHeader.m
new file mode 100644
index 0000000..a7e719a
--- /dev/null
+++ b/matlab/+ismrmrd/AcquisitionHeader.m
@@ -0,0 +1,136 @@
+classdef AcquisitionHeader
+
+ 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 %
+ scan_counter = uint32(0); % Current acquisition number in the measurement %
+ acquisition_time_stamp = uint32(0); % Acquisition clock %
+ physiology_time_stamp = zeros(1,3,'uint32'); % Physiology time stamps, e.g. ecg, breating, etc. %
+ number_of_samples = uint16(0); % Number of samples acquired %
+ available_channels = uint16(0); % Available coils %
+ active_channels = uint16(0); % Active coils on current acquisiton %
+ channel_mask = zeros(16,1,'uint64'); % Mask to indicate which channels are active. Support for 1024 channels %
+ discard_pre = uint16(0); % Samples to be discarded at the beginning of acquisition %
+ discard_post = uint16(0); % Samples to be discarded at the end of acquisition %
+ center_sample = uint16(0); % Sample at the center of k-space %
+ encoding_space_ref = uint16(0); % Reference to an encoding space, typically only one per acquisition %
+ trajectory_dimensions = uint16(0); % Indicates the dimensionality of the trajectory vector (0 means no trajectory) %
+ sample_time_us = single(0); % Time between samples in micro seconds, sampling BW %
+ 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 %
+ idx = ismrmrd.EncodingCounters; % Encoding loop counters, see above %
+ 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.scan_counter(obj,v)
+ obj.scan_counter = uint32(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.number_of_samples(obj,v)
+ obj.number_of_samples = uint16(v);
+ end
+
+ function obj = set.available_channels(obj,v)
+ obj.available_channels = uint16(v);
+ end
+
+ function obj = set.active_channels(obj,v)
+ obj.active_channels = uint16(v);
+ end
+
+ function obj = set.channel_mask(obj,v)
+ if (length(v)~=16)
+ error('AcquisitionHeader.channel_mask must have 16 elements')
+ end
+ obj.channel_mask = uint16(v);
+ end
+
+ function obj = set.discard_pre(obj,v)
+ obj.discard_pre = uint16(v);
+ end
+
+ function obj = set.discard_post(obj,v)
+ obj.discard_post = uint16(v);
+ end
+
+ function obj = set.center_sample(obj,v)
+ obj.center_sample = uint16(v);
+ end
+
+ function obj = set.encoding_space_ref(obj,v)
+ obj.encoding_space_ref = uint16(v);
+ end
+
+ function obj = set.trajectory_dimensions(obj,v)
+ obj.trajectory_dimensions = uint16(v);
+ end
+
+ function obj = set.sample_time_us(obj,v)
+ obj.sample_time_us = single(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.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
\ No newline at end of file
diff --git a/matlab/+ismrmrd/EncodingCounters.m b/matlab/+ismrmrd/EncodingCounters.m
new file mode 100644
index 0000000..44c7643
--- /dev/null
+++ b/matlab/+ismrmrd/EncodingCounters.m
@@ -0,0 +1,61 @@
+classdef EncodingCounters
+
+ properties
+ kspace_encode_step_1 = uint16(0); % e.g. phase encoding line number %
+ kspace_encode_step_2 = uint16(0); % e.g. partition encodning number %
+ 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 %
+ segment = uint16(0); % e.g. segment number for segmented acquisition %
+ user = zeros(1,8,'uint16'); % Free user parameters %
+ end
+
+ methods
+ function obj = set.kspace_encode_step_1(obj,v)
+ obj.kspace_encode_step_1 = uint16(v);
+ end
+
+ function obj = set.kspace_encode_step_2(obj,v)
+ obj.kspace_encode_step_2 = uint16(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.segment(obj,v)
+ obj.segment = uint16(v);
+ end
+
+ function obj = set.user(obj,v)
+ if (length(v)~=8)
+ error('EncodingCounters.user must have 8 elements')
+ end
+ obj.user = uint16(v);
+ end
+
+ end
+end % EncodingCounters
diff --git a/matlab/+ismrmrd/FlagBit.m b/matlab/+ismrmrd/FlagBit.m
new file mode 100644
index 0000000..1d9db26
--- /dev/null
+++ b/matlab/+ismrmrd/FlagBit.m
@@ -0,0 +1,31 @@
+classdef FlagBit
+ properties
+ bitmask_ = uint16(0);
+ end
+
+ methods
+ function fb = FlagBit(b)
+ if ~(b>0)
+ error('b must be positive');
+ else
+ fb.bitmask_ = bitshift(uint16(1),(b-1));
+ end
+ end % FlagBit
+ end
+
+ methods
+
+ function obj = set.bitmask_(obj,b)
+ obj.bitmask_ = uint16(b);
+ end % bitmask_ set function
+
+ function b = isSet(obj,m)
+ if (bitand(obj.bitmask_, uint16(m))>0)
+ b = true;
+ else
+ b = false;
+ end
+ end % isSet
+ end
+
+end % classdef
\ No newline at end of file
diff --git a/matlab/+ismrmrd/ImageDataType.m b/matlab/+ismrmrd/ImageDataType.m
new file mode 100644
index 0000000..e231a58
--- /dev/null
+++ b/matlab/+ismrmrd/ImageDataType.m
@@ -0,0 +1,9 @@
+classdef ImageDataType
+ properties(Constant)
+ DATA_FLOAT = 1,
+ DATA_DOUBLE = 2,
+ DATA_COMPLEX_FLOAT = 3,
+ DATA_COMPLEX_DOUBLE = 4,
+ DATA_UNSIGNED_SHORT = 5
+ end
+end
diff --git a/matlab/+ismrmrd/ImageFlags.m b/matlab/+ismrmrd/ImageFlags.m
new file mode 100644
index 0000000..fda74b5
--- /dev/null
+++ b/matlab/+ismrmrd/ImageFlags.m
@@ -0,0 +1,14 @@
+% IMAGE FLAGS %
+classdef ImageFlags
+ properties(Constant)
+ 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
+ end
+end
\ No newline at end of file
diff --git a/matlab/+ismrmrd/ImageType.m b/matlab/+ismrmrd/ImageType.m
new file mode 100644
index 0000000..7e1cd59
--- /dev/null
+++ b/matlab/+ismrmrd/ImageType.m
@@ -0,0 +1,9 @@
+classdef ImageType
+ properties(Constant)
+ TYPE_MAGNITUDE = 1,
+ TYPE_PHASE = 2,
+ TYPE_REAL = 3,
+ TYPE_IMAG = 4,
+ TYPE_COMPLEX = 5
+ end
+end
diff --git a/matlab/+ismrmrd/isInt.m b/matlab/+ismrmrd/isInt.m
new file mode 100644
index 0000000..f12a0aa
--- /dev/null
+++ b/matlab/+ismrmrd/isInt.m
@@ -0,0 +1,5 @@
+function b = isInt(a)
+
+ b = isa(a,'integer') || (imag(a)==0 && mod(a,1)==0);
+
+end
\ No newline at end of file
--
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