Login  Register

Saving all open images with sequential numbering

Posted by sam on Jan 26, 2014; 11:09am
URL: http://imagej.273.s1.nabble.com/Saving-all-open-images-with-sequential-numbering-tp5006281.html

Hi there,

Apologies for the basic question but I'm new to ImageJ macros.

I am trying to write a macro to save all open images with a single prefix, followed by a sequential number.

e.g. Image1, Image2.tif, image3.tif, Image4.tif etc

I can't get the sequential numbering right.  The best I can get is uging their unique Image ID, which isn't quite what I want:



// get image IDs of all open images
dir = getDirectory("Choose a Directory");
ids=newArray(nImages);
for (i=0;i<nImages;i++) {
        selectImage(i+1);
        ids[i]=getImageID;

// save the images based on their inique ID

saveAs("Tiff", dir+"sd2"+ids[i]);


}


Can anyone help?  Many thanks in advance,