How to go through a folder of dicom files and save them according to id's from a spreadsheet after anonymizing?

2 次查看(过去 30 天)
I have a folder of dicom files with names that are 7 digits long. EX. 1234567.dcm I have a spreadsheet with a column of these names and an id (col.1 1234567, col.2 01).
I am trying to anonymize the files while in that folder in matlab
files = dir('*.dcm') ; % in folder of dcm files
N = length(files) ; % total number of files
% loop for each file
for i = 1:N
%this part works
dicomanon('1234567_Rfemur.dcm','005R.dcm');
info = dicominfo('005R.dcm');
info.StudyDate = '';
info.PerformedProcedureStepStartDat = '';
info.PerformedProcedureStepStartTime = '';
info.SOPInstanceUID = '';
info.StudyTime = '';
info.ManufacturerModelName = '';
info.DateOfSecondaryCapture = '';
info.TimeOfSecondaryCapture = '';
info.PerformedProcedureStepID = '';
info.PerformedProcedureStepStartDate='';
dicomwrite(I,'005R.dcm',info);
%until this part works
end
Not sure if the loop is correct and where to incorporate the excel file. The file must be renamed to have an R or L depending on side. I run the code that works for each file and save it as the corresponding id number from my excel file. I don't know if this can be automated.
Example of excel file:
ID No. mrn Leg
005 1234567 Right Femur

回答(1 个)

Asvin Kumar
Asvin Kumar 2021-1-4
编辑:Asvin Kumar 2021-1-4
This process can definitely be automated.
Although I’m not entirely clear as to how you want to rename your files, I understand that you’d like to access/modify an Excel file. The readtable and writetable functions should help you do that. Have a look at the examples in both the pages to get an idea on how to use them.
You might also be interested in copyfile, movefile and delete.

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by