Index in position 1 exceeds array bounds. Index must not exceed 1.
    5 ビュー (過去 30 日間)
  
       古いコメントを表示
    
While I am trying to convert H5 file to mat file I got this error. The code is below:
close all; clear all;
addpath(genpath('.\'));
file_name_data = 'file_brain_AXFLAIR_200_6002425.h5';
info = h5info(file_name_data);
h5disp(file_name_data,'/');
struct_data = h5read(file_name_data,'/kspace');
raw_data = complex(struct_data(1:1:20,:,:,:),struct_data(1:1:20,:,:,:));
raw_data_xyz = fftshift(ifft(raw_data, 640, 4),4);
image_data_xyz = ifft(ifft(ifft(raw_data_xyz,640,4),320,3),20,2);
% figure,imshow(abs(squeeze(raw_data_xfft(6,100,:,:))),[]);
figure,imshow(abs(squeeze(image_data_xyz(6,100,:,:))),[]);
save(strcat(file_name_data,'.mat'),'raw_data_xyz');
output is below:
HDF5 file_brain_AXFLAIR_200_6002425.h5 
Group '/' 
    Attributes:
        'norm':  0.091318
        'max':  0.000427
        'patient_id':  'dcfc3e70496246a709dab23831262b60589f4383d6e05bf5559731ea8d80bb1f'
        'acquisition':  'AXFLAIR'
    Dataset 'ismrmrd_header' 
        Size:  scalar
        Datatype:   H5T_STRING
            String Length: variable
            Padding: H5T_STR_NULLTERM
            Character Set: H5T_CSET_ASCII
            Character Type: H5T_C_S1
        ChunkSize:  []
        Filters:  none
    Dataset 'kspace' 
        Size:  320x640x20x16
        MaxSize:  320x640x20x16
        Datatype:   H5T_COMPOUND
            Member 'r':  H5T_IEEE_F32LE (single)
            Member 'i':  H5T_IEEE_F32LE (single)
        ChunkSize:  []
        Filters:  none
        FillValue:  H5T_COMPOUND
    Dataset 'reconstruction_rss' 
        Size:  320x320x16
        MaxSize:  320x320x16
        Datatype:   H5T_IEEE_F32LE (single)
        ChunkSize:  []
        Filters:  none
        FillValue:  0.000000
Index in position 1 exceeds array bounds. Index must not exceed 1.
Error in h5_to_mat (line 8)
raw_data = complex(struct_data(1:1:20,:,:,:),struct_data(1:1:20,:,:,:));
5 件のコメント
  Geoff Hayes
      
      
 2022 年 3 月 17 日
				@Gulfam Saju - according to the above, struct_data is a 1x1 struct. You are treating it as if it had 3 dimensions. I suspect there is a field/member of that struct which has the data you want.
採用された回答
  Walter Roberson
      
      
 2022 年 3 月 17 日
            Dataset 'kspace' 
        Size:  320x640x20x16
        MaxSize:  320x640x20x16
        Datatype:   H5T_COMPOUND
            Member 'r':  H5T_IEEE_F32LE (single)
            Member 'i':  H5T_IEEE_F32LE (single)
        ChunkSize:  []
        Filters:  none
        FillValue:  H5T_COMPOUND
Notice that it says it is a structure!
You probably need
raw_data = complex(struct_data.r(1:1:20,:,:,:), struct_data.i(1:1:20,:,:,:));
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Spreadsheets についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!