Help with Batch Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help with Batch Plugin

Pascal Lorentz
Dear all,

I need some help with a plugin.
I have a folder with some lsm one color stacks. I would like to transfer the
whole stacks to 8 bit and save the single Images as jpg in a different folder
for example.
Sometimes the plugin works sometimes not. I don't know why. Something must be
wrong with the for loops I guess.

Here is my code. Any help would be great:

{requires("1.38x");

      dir1 = getDirectory("Choose Source Directory ");
      dir2 = getDirectory("Choose Destination Directory ");

       Dialog.create("Output Depth and Format");
       Dialog.addChoice("        Output
Depth",newArray("8-bit","16-bit","32-bit","8-bit Color","RGB Color"));
       Dialog.addChoice("        Output
Format",newArray("Tiff","Jpeg","Gif","BMP","PNG"));
       Dialog.show();

depth = Dialog.getChoice();
format = Dialog.getChoice();

      list = getFileList(dir1);
      setBatchMode(true);
 for (i=0; i<list.length; i++)
 {
    open(dir1+list[i]);
    slicenumber = nSlices;
    run(depth);
    run("Stack to Images");
for (x=0; x<slicenumber; x++)
{  filename = getTitle;
   saveAs(format, dir2+filename);
   close();
   showProgress(x+1, slicenumber);
}
showProgress(i+1, list.length);
      }
}

Cheers

Pascal


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.