How to Rename Dicom files
4 views (last 30 days)
Show older comments
I'm trying to rename a bunch of Dicom files, my script works well in Windows but not in Mac. The file format is IM-0001-0001.dcm; IM-0001-0002.dcm and so on.
and my code is:
-----------------------------------------------------------
dcmfiles = ls('*');
dcmfiles=dcmfiles(3:end,:)
newfolder = 'new';
mkdir(newfolder);
Seriesname = input('Prefix for the new name?','s');
for i = [1:size(dcmfiles,1)],
[PATHSTR,NAME,EXT] = fileparts(dcmfiles(i,:));
NAME = Seriesname;
newname=strcat(NAME,num2str(i),EXT);
str = dicomread(dcmfiles(i,:));
cd new
dicomwrite(str, newname);
cd ..
end
-------------------------------------------
I appreciate if anyone can help me?.
Many thanks in advance.
Regards, Afsaneh
0 Comments
Answers (1)
See Also
Categories
Find more on DICOM Format 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!