Saving data...but how to include a number??

Posted by octavius on
URL: http://imagej.273.s1.nabble.com/Saving-data-but-how-to-include-a-number-tp5001417.html

Hello everyone,

I have a stack composed of 5535 frames. I would like to convert that stack into images and save each image as follows fov1_0001.tif, fov1_0002.tif till fov1_5535.tif. This is what I have:

n=nSlices();
n=5535;

for (i=1; i<=n; i++)        
{
         a=i;
         b=i+0;
         run("Z Project...", "start="+a+" stop="+b+" projection=[Max Intensity]");
         saveAs("Tiff", "C:\\Users\\blaaa\\bloooo\\weeed\\Images\\fov1_"+04i+".tif");
         close();                
}

However it is incorrect because I get an error message. How do I save it as fov1_0001.tif, fov1_0002.tif till fov1_5535.tif and also how do I convert to images without having to do to that max intensity projection, because my computer crashes if I simply run the stack to images.

Any help and suggestions would be awesome.

Octavius