Re: How to reference next image in Batch Macro

Posted by G. Esteban Fernandez on
URL: http://imagej.273.s1.nabble.com/How-to-reference-next-image-in-Batch-Macro-tp5013954p5014023.html

This is what I'd do:

dir = getDirectory("Choose a folder");
files = getFileList(dir);

for(i = 0; i < files.length - 1; i++){
     open(dir + files[i]);
     image1 = getTitle();

     open(dir + files[i+1]);
     image2 = getTitle();

     imageCalculator("Subtract create", image2, image1);

     selectWindow(image1);
     close();
     selectWindow(image2);
     close();
}

At the end you're left with all the subtraction results open in separate
windows.

-Esteban
On Aug 13, 2015 11:25 AM, "Anish Prasanna" <[hidden email]> wrote:

> here is the current code i have:
>
> dir = getDirectory("DSC_0179.JPG");
> files = getFileList(dir);
> i=0;
> for(i = 0; i < files.length - 1; i++){
>      open(dir + files[i]);
>      open(dir + files[i+1]);
>      imageCalculator("Subtract create",(dir + files[i+1]),(dir +
> files[i]));
> }
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/How-to-reference-next-image-in-Batch-Macro-tp5013954p5014010.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