Subscripted Assignment between dissimilar structures when reading DICOM
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
Jan
2012-8-22
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!