save all opened images and changing their name
Posted by inesica on Apr 04, 2016; 8:26am
URL: http://imagej.273.s1.nabble.com/save-all-opened-images-and-changing-their-name-tp5016055.html
Hello everybody. I am new to ImageJ, so I would need your help. I want to save all my opened images that are called: Stack_Reg-0001, Stack_Reg-0002 etc. I used a macro from a previously asked question about this:
// get image IDs of all open images
dir = getDirectory("Choose a Directory");
ids=newArray(nImages);
for (i=0;i<nImages;i++) {
selectImage(i+1);
title = getTitle;
print(title);
ids[i]=getImageID;
saveAs("tiff", dir+title);
}
However, since I am using a matlab program that needs the files with a certain name, I need to change their name. I would like to have them as: z0000_t0000, z0001_t0000, z0002_t0000 etc, until z0024_t0000. Is it possible to do this in the macro?
Thank you very much in advance.