How to save multiple dicom images in to a single mat file?
10 次查看(过去 30 天)
显示 更早的评论
I have 100 MRI images in dicom format. How can I save all of them in a single .mat file? Thank you in advance.
0 个评论
回答(2 个)
yanqi liu
2022-3-25
fd = fullfile(pwd, 'dcms');
fs = ls(fullfile(fd, '*.dcm'));
ims = [];
for i = 1 : size(fs,1)
im = dicomread(fullfile(fd, strtrim(fs(i,:))));
ims{i} = im;
end
save ims.mat ims
3 个评论
Rupika Raj
2022-9-26
Hi, I made some changes in Yanqi Liu's answer. Try this!
fd = fullfile(pwd);
fs = ls(fullfile(fd, '*.dcm'));
ims = [];
for i = 1 : size(fs,1)
im = dicomread(fullfile(fd, strtrim(fs(i,:))));
ims(:,:,i) = im;
end
save ims.mat ims
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!