Dear Samuel
Your problem is that you are selecting images with select image(i) and then
closing the processed image. When you do this the list of images changes:
image 1 goes away and image 2 becomes image 1, so it is skipped when you
selectImage(2).
What you can do is selectImage(nImages) so that you always work with the
last image from the images list.
Sincerely
Jerome.
Le 5 avr. 2014 10:20, "sam" <
[hidden email]> a écrit :
> Hi there,
>
> I am trying to write a macro to do some basic batch processing on all open
> images. For some reason it only does 2 or 3 of the open images, then
> stops,
> so I have to keep running the macro until the job is done.
>
> Can anyone see what I am doing wrong? Thanks for your help!
>
> The macro is below:
>
> dir = getDirectory("Choose a Directory");
>
> for (i=1; i<=nImages; i++) {
> selectImage(i);
> processImage();
> }
>
> function processImage() {
>
> title=getTitle;
> run("Make Composite", "display=Color");
> Stack.setChannel(1);
> resetMinAndMax();
> run("Red");
> Stack.setChannel(2);
> resetMinAndMax();
> run("Grays");
> Stack.setChannel(3);
> resetMinAndMax();
> run("Green");
>
> saveAs("tiff", dir+title);
> close;
>
> }
>
>
>
>
>
> --
> View this message in context:
>
http://imagej.1557.x6.nabble.com/Problem-with-batch-processing-tp5007213.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