Posted by
CARL Philippe (LBP) on
Apr 04, 2016; 9:16am
URL: http://imagej.273.s1.nabble.com/save-all-opened-images-and-changing-their-name-tp5016055p5016056.html
Dear inesica,
You were not very far from the solution you are looking for since you just
need to replace the line "saveAs("tiff", dir+title);" with "saveAs("tiff",
dir + "z" + substring(title, 10, lengthOf(title)) +"_t0000");" or if you
want something "slightly" more complicated by "saveAs("tiff", dir + "z" +
substring(title, indexOf(title, "-") + 1, lengthOf(title)) +"_t0000");"
Nevertheless, I'm not really convinced that an ImageJ macro is the most
adapted tool for performing what you trying to do.
And for such a job (and if you are under Windows), I would rather recommend
you Total_Commander that can be found under the following link:
http://www.ghisler.comThey have a very powerful File->Multi-Rename_Tool with which what you are
looking for is done within seconds.
In parallel, Total_Commander has a File->Compare_by_content... tool which is
really cool in the case you have several versions of a given macro and you
want to know what differentiate them.
I hope I helped you to move further in your work and wish you a nice day.
My best regards,
Philippe
Philippe CARL
Laboratoire de Biophotonique et Pharmacologie
UMR 7213 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84
-----Message d'origine-----
De : ImageJ Interest Group [mailto:
[hidden email]] De la part de
inesica
Envoyé : lundi 4 avril 2016 10:27
À :
[hidden email]
Objet : save all opened images and changing their name
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.
--
View this message in context:
http://imagej.1557.x6.nabble.com/save-all-opened-images-and-changing-their-name-tp5016055.html
Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html