How to save multiple dicom images in to a single mat file?

9 vues (au cours des 30 derniers jours)
Shourya
Shourya le 24 Mar 2022
I have 100 MRI images in dicom format. How can I save all of them in a single .mat file? Thank you in advance.

Réponses (2)

yanqi liu
yanqi liu le 25 Mar 2022
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 commentaires
Shourya
Shourya le 28 Mar 2022
I got a mat file of size 1x100 where each cell represents an image . How can I get a matrix where each column represents an image?
Bhagavathula Meena
Bhagavathula Meena le 24 Sep 2022
Yes am also facing same problem related to my work .

Connectez-vous pour commenter.


Rupika Raj
Rupika Raj le 26 Sep 2022
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

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by