[ismrmrd] 42/281: MAJOR LAYOUT CHANGE: Acquisition data now stored as variable length array of FLOAT and not as a compound type. This change was made to improve interoperability with Matlab, etc.

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 e96c3d522e95a716d2026e849bd09668189f1480
Author: Michael S. Hansen <michael.hansen at nih.gov>
Date:   Mon Sep 10 16:18:10 2012 -0400

    MAJOR LAYOUT CHANGE: Acquisition data now stored as variable length array of FLOAT and not as a compound type. This change was made to improve interoperability with Matlab, etc.
---
 ismrmrd_hdf5.cpp                 |  2 +-
 ismrmrd_hdf5_datatypes.h         |  6 +++---
 matlab/+ismrmrd/hdf5_datatypes.m | 16 ++++++++--------
 matlab/testread.m                |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/ismrmrd_hdf5.cpp b/ismrmrd_hdf5.cpp
index 19787d3..4eec514 100644
--- a/ismrmrd_hdf5.cpp
+++ b/ismrmrd_hdf5.cpp
@@ -320,7 +320,7 @@ int IsmrmrdDataset::appendAcquisition(Acquisition* a)
 		tmp.traj.len = tmp.head.trajectory_dimensions*tmp.head.number_of_samples;
 		tmp.traj.p = static_cast<void*>(a->traj_);
 
-		tmp.data.len = tmp.head.active_channels*tmp.head.number_of_samples;
+		tmp.data.len = tmp.head.active_channels*tmp.head.number_of_samples*2;
 		tmp.data.p = static_cast<void*>(a->data_);
 
 		DataSpace mspace1 = dataset_->getSpace();
diff --git a/ismrmrd_hdf5_datatypes.h b/ismrmrd_hdf5_datatypes.h
index 4959534..31ef758 100644
--- a/ismrmrd_hdf5_datatypes.h
+++ b/ismrmrd_hdf5_datatypes.h
@@ -176,13 +176,13 @@ template <> boost::shared_ptr<DataType> getIsmrmrdHDF5Type<AcquisitionHeader_wit
 	boost::shared_ptr<CompType> ret = boost::shared_ptr<CompType>(new CompType(sizeof(AcquisitionHeader_with_data)));
 
 	boost::shared_ptr<DataType>  head_type = getIsmrmrdHDF5Type<AcquisitionHeader>();
-	boost::shared_ptr<DataType> cxvdatatype = getIsmrmrdHDF5Type<complex_t>();
-	cxvdatatype = boost::shared_ptr<DataType>(new DataType(H5Tvlen_create (cxvdatatype->getId())));
+	//boost::shared_ptr<DataType> cxvdatatype = getIsmrmrdHDF5Type<complex_t>();
+	//cxvdatatype = boost::shared_ptr<DataType>(new DataType(H5Tvlen_create (cxvdatatype->getId())));
 	boost::shared_ptr<DataType> realvdatatype = boost::shared_ptr<DataType>(new DataType(H5Tvlen_create (PredType::NATIVE_FLOAT.getId())));
 
 	ret->insertMember( "head",  HOFFSET(AcquisitionHeader_with_data,head),   	*head_type);
 	ret->insertMember( "traj", HOFFSET(AcquisitionHeader_with_data,traj),  		*realvdatatype);
-	ret->insertMember( "data", HOFFSET(AcquisitionHeader_with_data,data),  		*cxvdatatype);
+	ret->insertMember( "data", HOFFSET(AcquisitionHeader_with_data,data),  		*realvdatatype);
 	return ret;
 }
 
diff --git a/matlab/+ismrmrd/hdf5_datatypes.m b/matlab/+ismrmrd/hdf5_datatypes.m
index 2fa9ed9..c2315c1 100644
--- a/matlab/+ismrmrd/hdf5_datatypes.m
+++ b/matlab/+ismrmrd/hdf5_datatypes.m
@@ -65,7 +65,7 @@ classdef hdf5_datatypes
             H5T.insert(b, 'segment', offset, 'H5T_NATIVE_UINT16');
             offset = offset + H5T.get_size('H5T_NATIVE_UINT16');
             
-            H5T.insert(b, 'user', offset, H5T.array_create('H5T_NATIVE_UINT16',[1 8]));
+            H5T.insert(b, 'user', offset, H5T.array_create('H5T_NATIVE_UINT16',[8]));
             
         end
  
@@ -113,7 +113,7 @@ 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',[1 3]));
+            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');
@@ -125,7 +125,7 @@ classdef hdf5_datatypes
             H5T.insert(b, 'active_channels', offset, 'H5T_NATIVE_UINT16');
             offset = offset + H5T.get_size('H5T_NATIVE_UINT16');
             
-            H5T.insert(b, 'channel_mask', offset, H5T.array_create('H5T_NATIVE_UINT64',[1 16]));
+            H5T.insert(b, 'channel_mask', offset, H5T.array_create('H5T_NATIVE_UINT64',[16]));
             offset = offset + 16*H5T.get_size('H5T_NATIVE_UINT64');
             
             H5T.insert(b, 'discard_pre', offset, 'H5T_NATIVE_UINT16');
@@ -146,22 +146,22 @@ classdef hdf5_datatypes
             H5T.insert(b, 'sample_time_us', offset, 'H5T_NATIVE_FLOAT');
             offset = offset + H5T.get_size('H5T_NATIVE_FLOAT');
 
-            H5T.insert(b, 'position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[1 3]));
+            H5T.insert(b, 'position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
             offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
 
-            H5T.insert(b, 'quaternion', offset, H5T.array_create('H5T_NATIVE_FLOAT',[1 4]));
+            H5T.insert(b, 'quaternion', offset, H5T.array_create('H5T_NATIVE_FLOAT',[4]));
             offset = offset + 4*H5T.get_size('H5T_NATIVE_FLOAT');
             
-            H5T.insert(b, 'patient_table_position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[1 3]));
+            H5T.insert(b, 'patient_table_position', offset, H5T.array_create('H5T_NATIVE_FLOAT',[3]));
             offset = offset + 3*H5T.get_size('H5T_NATIVE_FLOAT');
             
             H5T.insert(b, 'idx', offset, ismrmrd.hdf5_datatypes.getType_EncodingCounters);
             offset = offset + H5T.get_size(ismrmrd.hdf5_datatypes.getType_EncodingCounters);
             
-            H5T.insert(b, 'user_int', offset, H5T.array_create('H5T_NATIVE_INT32',[1 8]));
+            H5T.insert(b, 'user_int', offset, H5T.array_create('H5T_NATIVE_INT32',[8]));
             offset = offset + 8*H5T.get_size('H5T_NATIVE_INT32');
 
-            H5T.insert(b, 'user_float', offset, H5T.array_create('H5T_NATIVE_FLOAT',[1 8]));
+            H5T.insert(b, 'user_float', offset, H5T.array_create('H5T_NATIVE_FLOAT',[8]));
             %offset = offset + 8*H5T.get_size('H5T_NATIVE_FLOAT');
 
         end
diff --git a/matlab/testread.m b/matlab/testread.m
index 3e6f36c..bd2f558 100644
--- a/matlab/testread.m
+++ b/matlab/testread.m
@@ -1,4 +1,4 @@
-filename = '~/gadgetron/ismrmrd_data/testdata.h5';
+filename = '~/temp/testdata.h5';
 
 % Open the HDF5 File
 file = H5F.open(filename, 'H5F_ACC_RDONLY', 'H5P_DEFAULT');

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