Batch Processing, channel split window name.

Posted by MickMunson on
URL: http://imagej.273.s1.nabble.com/Batch-Processing-channel-split-window-name-tp5016467.html

Hi,

I am very new to macro creating so apologies if it is something simple I am missing.

I have created a macro to first of all split a three colour image and then to process these channels relative to each other. This macro seems to work perfectly fine if I manually open a single image then run the macro, however I am having trouble when I use this to batch process a series of images from a folder. Normally if I open then split the channels it creates three windows, C1-/C2-/C3- file name. When batch processing it hits an error saying file by this name doesn't exist. I'm not sure if there is an easy way to troubleshoot this? Also is there any easy way to store the data from each file processed that can be included in the macro?

Macro:

T = getTitle();
selectWindow(T);
run("Split Channels");

selectWindow("C1-"+T);
Blue = getTitle();
selectWindow("C2-"+T);
Green = getTitle();
selectWindow("C3-"+T);
Red = getTitle();

selectWindow(Red);
setAutoThreshold("Default dark");
run("Threshold...");
setThreshold(20, 255);
setOption("BlackBackground", false);
run("Convert to Mask");

selectWindow(Green);
setAutoThreshold("Default dark");
run("Threshold...");
setThreshold(20, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Create Selection");

selectWindow(Red);
run("Restore Selection");
run("Enlarge...", "enlarge=2 pixel");
run("Clear", "slice");
run("Invert");
run("Select None");
run("Analyze Particles...", "size=0.10-Infinity pixel show=Outlines display exclude include summarize");

Many thanks for your time and help.