Clear Filters
Clear Filters

Rename images using ImageIndex

3 views (last 30 days)
Ann G
Ann G on 23 Oct 2015
Edited: 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?

Accepted Answer

Image Analyst
Image Analyst on 23 Oct 2015
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
Ann G on 24 Oct 2015
Edited: 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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!