dicominfo returns an error on all dicom files other than one
Show older comments
Hi all, i have a question. I'm writing some codes to read in the dicom tags of a series of dicom files. but somehow, dicominfo can only read the first data but returns an error on other data.
sourcedata = '/Users/.../dcmonly'
filesandfolders= dir([sourcedata '/**']);
%Plist = setdiff({ P_f([P_f.isdir]).name},{'.','..'});
all_list = {filesandfolders.name};
T = cell2table({});
for ii = 3: numel(all_list)
name = all_list{ii}
info(ii) = dicominfo(name);
s2det = [info.DistanceSourceToDetector];
s2pat = [info.DistanceSourceToPatient];
pixelspace = [info.ImagerPixelSpacing];
pixelsize = pixelspace * (s2det/s2pat);
Nf = 1/(2* pixelsize);
% write data to excel
T.s2det = s2det;
T.s2pat = s2pat;
T.pixelspace = pixelspace(1);
T.pixelsize = pixelsize(1);
T.Nf = Nf;
end
this is the error i got
Error using dicom_getFileDetails (line 14)
Unable to load file "00000018.dcm".
Error in dicominfo (line 55)
fileDetails = dicom_getFileDetails(filename);
Error in dicomtags (line 17)
info(ii) = dicominfo(name);
FYI the code after %write data to excel is pretty self explanatory, but i wanna append every info from other dicom files too in the sam excel file. i'm not sure how to go about this either. any help would be very much appreciated!
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets 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!