필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
Shourya
Shourya 2022년 3월 24일
답변: Rupika Raj 2022년 9월 26일
I have 100 MRI images in dicom format. How can I save all of them in a single .mat file? Thank you in advance.

답변 (2개)

yanqi liu
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
Shourya
Shourya 2022년 3월 28일
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 2022년 9월 24일
Yes am also facing same problem related to my work .

댓글을 달려면 로그인하십시오.


Rupika Raj
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

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by