how to write multiple dicom files into a folder using 'dicomwrite' command
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
using for loop, i can read all the 'k' dicom files present in the folder . After performing some operation on each slice, i need to save them into another folder .
Someone please help me
names=dir(fullfile('C:\matlab\*.dcm'));
for k=1:size(names, 1)
I(:,:,k)=dicomread(names(k).name);
P=I(:,:,k);
M(:,:,k) = foperation(P);
%figure(k)
% imshow(Mask(:,:,k))
dicomwrite(Mask(:,:,k),'mask_01.dcm') // what and how should i change this line to save all k files into another folder
end
0 commentaires
Réponses (1)
Subhadeep Koley
le 22 Jan 2020
Hi, your code is almost correct. You only need to give different name to the 'k' different DICOM files. The below code might help!
names=dir(fullfile('C:\matlab\*.dcm'));
for k = 1:size(names, 1)
I(:,:,k) = dicomread(names(k).name);
P = I(:,:,k);
M(:,:,k) = foperation(P);
% figure(k);
% imshow(Mask(:,:,k));
dicomwrite(Mask(:,:,k),['putYourFolderPathHere\','mask_01_',num2str(k),'.dcm']);
end
0 commentaires
Voir également
Catégories
En savoir plus sur DICOM Format 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!