// "Batch RG Merge" // Opens multiple sets of two separate color channels, color merges them // into a RG stack, batch processes all files in a folder. // File names ending in "C1" and "C0" are assumed to be red and green channels respectively, // but this can be changed in the dialog box that comes up // (Slidebook uses "C1" and "C0" to auto-name exported images) // Or change this in lines 2 and 3 to whatever your program of choice // exports and sames R and G with a prefix or suffix. // This macro was modified from the one at // http://rsb.info.nih.gov/ij/macros/Batch_RGB_Merge.txt Dialog.create("RG Batch Convert"); Dialog.addString("Red Suffix:", "C1"); Dialog.addString("Green Suffix:", "C0"); Dialog.show(); redSuffix = Dialog.getString() + "."; greenSuffix = Dialog.getString() + "."; dir1 = getDirectory("Choose Source Directory "); dir2 = getDirectory("Choose Destination Directory "); list = getFileList(dir1); setBatchMode(true); n = list.length; if ((n%2)!=0) exit("The number of files must be a multiple of 2"); stack = 0; first = 0; for (i=0; i