필터 지우기
필터 지우기

Index in position 1 exceeds array bounds. Index must not exceed 1.

조회 수: 12 (최근 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
Gulfam Saju
Gulfam Saju 2022년 3월 17일
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
Name Size Bytes Class Attributes
file_name_data 1x33 66 char
info 1x1 20340 struct
struct_data 1x1 524288336 struct
Geoff Hayes
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
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
Gulfam Saju
Gulfam Saju 2022년 3월 17일
Index in position 2 exceeds array bounds. Index must not exceed 20.
Error in h5_to_mat (line 13)
figure,imshow(abs(squeeze(image_data_xyz(6,100,:,:))),[]);
I got this error.
Walter Roberson
Walter Roberson 2022년 3월 17일
What shows up if you ask
size(struct_data.r)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by