MATLAB Answers

Ann G
0

Rename images using ImageIndex

Asked by Ann G
on 23 Oct 2015
Latest activity Edited by Ann G
on 24 Oct 2015
Hello everyone! I would like to ask you how can I rename images (DICOM) in a folder using ImageIndex of each one from their info?

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 23 Oct 2015
 Accepted Answer

Use movefile() in a loop from the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F to rename a group of files in a folder.

  1 Comment

Ann G
on 24 Oct 2015
Actually, I want to use the commands info=dicominfo(), dicomread and dicomwrite in a loop so that matlab will identify the imageindexof each image individually using idx=info.ImageIndex and then with dicomwrite change it's name by using the ImageIndex(number of slice). Here is what I already have: info=dicominfo('*.dcm');
idx=info.ImageIndex;
fname=sprintf('IQ_NEW_FDG_EANM15_%03d.dcm'),idx
X=dicomread('*.dcm');
dicomwrite(X,'IQ_NEW_FDG_EAMN15_%03d.dcm');

Sign in to comment.