Subscripted Assignment between dissimilar structures when reading DICOM

1 view (last 30 days)
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?

Answers (1)

Jan
Jan on 22 Aug 2012
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

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!