Login  Register

Image is overwritten in batchmode

Posted by Johannes Breu on Jul 28, 2008; 5:33pm
URL: http://imagej.273.s1.nabble.com/Image-is-overwritten-in-batchmode-tp3695498.html

Hello,

I tried to use a macro (that worked if the image was open- a multi tiff
Z-stack) in BatchMode and could not prevent coming in trouble.
I wish to extract the two channels out of a Z-stack for doing some
procedures with them (just for testing if it works I tried to save them
separatly; and this doesn´t work).
Actually I would like to have two distinct images (in this code called
A_zproject_name and B_zproject_name):


      dir1 = getDirectory("Choose Source Directory ");
      dir2 = getDirectory("Choose Destination Directory ");
      list = getFileList(dir1);
      setBatchMode(true);
      for (i=0; i<list.length; i++) {
          showProgress(i+1, list.length);
          open(dir1+list[i]);

          Aid = getImageID();
          run("Z Project...", "start=1 stop=6 projection=[Max Intensity]");
          setAutoThreshold();
          //run("Threshold...");
          run("Convert to Mask");
          A_zproject_name = getTitle();
          saveAs("tiff", dir2+A_zproject_name);


          //This is the image of channel 1

          //restore selection to the first image
          selectImage(Aid);

          //make second projection
          run("Z Project...", "start=7 stop=12 projection=[Max Intensity]");
          run("Subtract...", "value=500");
          setAutoThreshold();
          //run("Threshold...");
          run("Convert to Mask");
          B_zproject_name = getTitle();
          saveAs("tiff", dir2+B_zproject_name);
          //This is the image of channel 2


          close();
          }

So I would like to have two distinct images which I wish to address for
further processing. How does this work?
Thanks
Johannes