// ********************************************************************** // declare global variable //var mypath="c:/"; // ********************************************************************** // "color_images" // Macro for artery imaging // Fabrice Duprat march 2013 // This macro // All images are from the same name prefixe "imagename" and an incremential extension number for each set of images (.001, .002, ...) // Red channel (1) image : "path/imagename1.number" // Green channel (2) image : "path/imagename2.number" // Blue channel (3) image : "path/imagename3.number" // Fluorescent channel (4) image : "path/imagename4.number" // Fluorescent channel (5) image : "path/imagename5.number" // // If you are using this script for a research article, please cite this web page: https://www.ipmc.cnrs.fr/~duprat/scripts/ // macro "color_images" { // Fluorescent channel to add to the color image mychannel = 5; mycolor = "Yellow"; // Choose color for fluorescent "Red", "Green", "Blue", "Cyan", "Magenta", "Yellow" while (1) { //run("Close All"); redimage = File.openDialog("Choose RED image (channel 1)"); open(redimage); rename("RED"); size = lengthOf(redimage); filename = substring(redimage, 0, size -5); // Path + name without channel number fileext = substring(redimage,size-4, size); // Make the file name of the other channel images to analyse in the same set greenimage = filename + "2" + fileext; open(greenimage); rename("GREEN"); blueimage = filename + "3" + fileext; open(blueimage); rename("BLUE"); fluoimage = filename + mychannel + fileext; open(fluoimage); rename("FLUO"); run(mycolor); run("Merge Channels...", "red=RED green=GREEN blue=BLUE gray=*None* "); run("Duplicate...", "title=COMPOSITE"); imageCalculator("Add", "COMPOSITE","FLUO"); fileext = substring(fileext,1, 4); // extension without the "." run("Images to Stack", "name="+ filename + "_color" + fileext + " title=[] use"); saveAs("Tiff", filename + "_color" + fileext +".tif"); } // end of while } // end of macro