MATLAB讀取hdf文件
https://blog.csdn.net/good_learner_1/article/details/100047950?
1. 顯示hdf文件中的數(shù)據(jù)集以及屬性等等信息
1. 顯示hdf文件中的數(shù)據(jù)集以及屬性等等信息
h5disp('文件名.hdf');
1
例如:
h5disp('dataset/sample_A_padded_20160501.hdf');
# 輸出:
HDF5 sample_A_padded_20160501.hdf
Group'/'
? ? Attributes:
'file_format':? '0.2'
Group'/annotations'
? ? ? ? Attributes:
'offset':? 1520.000000 3644.000000 3644.000000
Dataset'ids'
Size:432
MaxSize:432
? ? ? ? ? ? Datatype:? H5T_STD_U64LE (uint64)
? ? ? ? ? ? ChunkSize:? []
? ? ? ? ? ? Filters:? none
FillValue:0
Dataset'locations'
Size:3x432
MaxSize:3x432
Datatype:? H5T_IEEE_F32LE (single)
? ? ? ? ? ? ChunkSize:? []
? ? ? ? ? ? Filters:? none
FillValue:0.000000
Dataset'types'
Size:432
MaxSize:432
? ? ? ? ? ? Datatype:? H5T_STRING
StringLength: variable
? ? ? ? ? ? ? ? Padding: H5T_STR_NULLTERM
CharacterSet: H5T_CSET_UTF8
? ? ? ? ? ? ? ? Character Type: H5T_C_S1
ChunkSize:432
Filters:? deflate(4)
Group'/annotations/comments'
Dataset'comments'
Size:17
MaxSize:17
? ? ? ? ? ? ? ? Datatype:? H5T_STRING
StringLength: variable
? ? ? ? ? ? ? ? ? ? Padding: H5T_STR_NULLTERM
CharacterSet: H5T_CSET_UTF8
? ? ? ? ? ? ? ? ? ? Character Type: H5T_C_S1
? ? ? ? ? ? ? ? ChunkSize:? []
? ? ? ? ? ? ? ? Filters:? none
Dataset'target_ids'
Size:17
MaxSize:17
? ? ? ? ? ? ? ? Datatype:? H5T_STD_U64LE (uint64)
? ? ? ? ? ? ? ? ChunkSize:? []
? ? ? ? ? ? ? ? Filters:? none
FillValue:0
Group'/annotations/presynaptic_site'
Dataset'partners'
Size:2x216
MaxSize:2x216
? ? ? ? ? ? ? ? Datatype:? H5T_STD_U64LE (uint64)
? ? ? ? ? ? ? ? ChunkSize:? []
? ? ? ? ? ? ? ? Filters:? none
FillValue:0
Group'/volumes'
Dataset'raw'
Size:3072x3072x200
MaxSize:3072x3072x200
? ? ? ? ? ? Datatype:? H5T_STD_U8LE (uint8)
ChunkSize:192x96x7
Filters:? deflate(4)
? ? ? ? ? ? Attributes:
'resolution':? 40.000000 4.000000 4.000000
Group'/volumes/labels'
Dataset'clefts'
Size:1250x1250x125
MaxSize:1250x1250x125
? ? ? ? ? ? ? ? Datatype:? H5T_STD_U64LE (uint64)
ChunkSize:79x79x4
Filters:? deflate(4)
? ? ? ? ? ? ? ? Attributes:
'resolution':? 40.000000 4.000000 4.000000
'offset':? 1520.000000 3644.000000 3644.000000
Dataset'neuron_ids'
Size:1250x1250x125
MaxSize:1250x1250x125
? ? ? ? ? ? ? ? Datatype:? H5T_STD_U64LE (uint64)
ChunkSize:79x79x4
Filters:? deflate(4)
? ? ? ? ? ? ? ? Attributes:
'resolution':? 40.000000 4.000000 4.000000
'offset':? 1520.000000 3644.000000 3644.000000
1
data= h5read('文件名.hdf','數(shù)據(jù)集名');
1
例如:
raw = h5read('dataset/sample_A_padded_20160501.hdf','/volumes/raw');
1
attribute = h5readatt('文件名.hdf','數(shù)據(jù)集名','屬性名');
1
例如:
resolution = h5readatt('dataset/sample_A_padded_20160501.hdf','/volumes/raw','resolution');
1
h5create('文件名.hdf','數(shù)據(jù)集名', 數(shù)據(jù)大小,'Datatype','數(shù)據(jù)類型');
1
例如:
h5create('downs_dataset/downsample_A_padded_20160501.hdf','/volumes/raw', size_downs_raw,'Datatype','uint8');
1
h5write('文件名.hdf','數(shù)據(jù)集名', 數(shù)據(jù)變量);
1
例如:
h5write('downs_dataset/downsample_A_padded_20160501.hdf','/volumes/raw', downs_raw);
1
h5writeatt('文件名.hdf','數(shù)據(jù)集名','屬性名', 屬性變量);
1
例如:
h5writeatt('downs_dataset/downsample_A_padded_20160501.hdf','/volumes/raw','resolution', resolution);
1