Subscripted Assignment between dissimilar structures when reading DICOM

조회 수: 2 (최근 30일)
Adam
Adam 2012년 8월 21일
Hi all, I'm using the dicominfo function to read the DICOM headers from a series of DICOM files. I am going through each successive file and storing the header in info(x):
for x = 1:nFiles
info(x) = dicominfo([pathname,Directory(x,1).name]);
SliceLocation(x) = info(x).SliceLocation;
TimeIndex(x) = info(x).InstanceNumber;
end
The problem I'm running into is that for whatever reason, some of the DICOM files contain an extra header. When the loop runs into the file with the extra header I get the "Subscripted assignment between dissimilar structures" error. This is troublesome, especially since I don't even need the information in the extra header. I'm only using a few of the header fields. I got around this by checking to see if that field exists and then passing it to another array, but doing this check significantly slows down the code since I have 1000+ images. Can anyone think of a way to deal with this without slowing down the code?

답변 (1개)

Jan
Jan 2012년 8월 22일
You can remove the additional field using the fast FEX: fRMField.
for x = nFiles:-1:1 % backwards for pre-allocation
data = dicominfo([pathname,Directory(x,1).name]);
data = fRMField(data, 'UnwantedField');
info(x) = data;
SliceLocation(x) = data.SliceLocation;
TimeIndex(x) = data.InstanceNumber;
end

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by