Sort and Rename dicom files without losing dicominfo
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all,
I have got several sets of dicom images i'm trying to order and rename. I have written a fine working algorithm, but unfortunately i doesn't work when i'm implementing dicominfo in the dicomwrite line. I need to use the SliceThickness and PixelSpacing later on, so i need to store this info. Can anybody explain why --> dicomwrite(A,(fname), info); doesn't work. And does anybody has a suggestion about the way to implement this?
if true
% uiwait(msgbox('Select directory to load files'))
fpath = uigetdir;
fstruct = dir('fpath\*.dcm');
dicomlist = dir(fullfile(fpath,fstruct','*.dcm'));
uiwait(msgbox('Select directory to save files'))
fpath1 = uigetdir;
cd(fpath1);
hWaitBar = waitbar(0,'Renaming DICOM files');
for i=length(dicomlist):-1:1;
A = dicomread(fullfile(fpath,fstruct,dicomlist(i).name));
info = dicominfo(fullfile(fpath,fstruct,dicomlist(i).name));
B = info.InstanceNumber;
if B <= 9;
fname = ['ADNI_MRI_00', num2str(B), '.dcm'];
elseif B <= 99;
fname = ['ADNI_MRI_0' num2str(B), '.dcm'];
else
fname = ['ADNI_MRI_', num2str(B), '.dcm'];
end
dicomwrite(A,(fname));
waitbar((length(dicomlist)-i)/length(dicomlist))
end
delete(hWaitBar)
end
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!