Re: Calling an ImageJ macro on files in sets of 3

Posted by Joost Willemse on
URL: http://imagej.273.s1.nabble.com/Calling-an-ImageJ-macro-on-files-in-sets-of-3-tp5013674p5013685.html

I think there are multiple solutions

to increment the i with a larger number just put

   for (i=0; i<list.length; i+=3) {
}

this works fine for increasing the numbers like you want.

However what I found out while coding myself is that the filelist is hardly logically ordered when it is obtained from the directory
therefore i think you need to make sure that you are calling the right files.

First sort the array so it should work

     Array.sort(list);

then while opening i would not go through the list like you are suggesting by just opening the next image file and assuming everything is correct

I'd use
original=   getTitle();
blue=substring(original,0,lengthOf(original)-4)+" (blue).jpg" // substring removes the .*** ending of the title. the + " (blue).***" adds the desired ending of the image to be opened.

this way you cannot open the wrong files

hope this helps
Joost

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html