Posted by
Christine Labno-2 on
Feb 20, 2015; 11:20pm
URL: http://imagej.273.s1.nabble.com/batch-processing-macro-problem-tp5011621p5011711.html
Hi Jacob.
I think the error window in the batch macro window is due to the macro only opening a single image, not a group of images.
It took me a bit to get this working, but assuming the Alexa488 image is the first in every group, the following code (based on your corrected single process code) will batch process a whole folder of your choosing, saving into the folder of your choosing. The macro will ask you to choose the folder to process and then the folder for saving once at the beginning of the macro.
Good luck!
Christine
______________begin_______________
dir = getDirectory("Choose a Directory to PROCESS");
list = getFileList(dir);
dir2 = getDirectory("Choose a Directory for SAVING THE MONTAGES");
setBatchMode(true);
for (f=0; f<list.length; f++) {
path = dir+list[f];
end = endsWith(path, "8.tif"); {
if (end==true) {
run("Image Sequence...", "open=path number=4 starting=f sort");
t=getInfo("slice.label");
//t=getTitle();
s=lastIndexOf(t, 'A');
t=substring(t, 0, s);
t=replace(t," ","_");
t2= t +' montage.tif';
print(t);
rename("Stack");
run("Stack to Hyperstack...", "order=xyczt(default) channels=4 slices=1 frames=1 display=Composite");
run("Arrange Channels...", "new=4123");
Stack.setDisplayMode("color");
Stack.setChannel(1);
run("Blue");
Stack.setChannel(2);
run("Green");
Stack.setChannel(3);
run("Red");
Stack.setChannel(4);
run("Magenta");
Stack.setDisplayMode("composite");
run("Stack to RGB");
rename("merge");
selectWindow("Stack");
Stack.setDisplayMode("color");
run("RGB Color");
run("Add Slice");
selectWindow("merge");
run("Copy");
selectWindow("Stack (RGB)");
run("Paste");
run("Make Montage...", "columns=5 rows=1 scale=1 first=1 last=5 increment=1 border=0 font=12");
rename(t2);
saveAs("Tiff", dir2 + t2 + ".tif");
run("Close All");
}
if (end==false) {
//print("nope");
run("Close All");
}
}
}
________________end_________________
--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)
________________________________________
From: ImageJ Interest Group [
[hidden email]] on behalf of jacob goodwin [
[hidden email]]
Sent: Wednesday, February 18, 2015 5:05 AM
To:
[hidden email]
Subject: Re: batch processing macro problem.
Sorry, I made an error. There must have already been some macro in the batch
macro window.
If I copy and paste your macro in there, it comes up with a window that says
Images to stack
There must be at least 2 open images.
Thanks
Jacob
--
View this message in context:
http://imagej.1557.x6.nabble.com/batch-processing-macro-problem-tp5011621p5011658.htmlSent 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