// This macro uses the "Invert LUTs", "RGB Stack", // and "Z Project" commands to reproduce the // four composite display modes in the "Channels" // dialog. It uses the currently open multi-channel image // (if it is the only open image), otherwise it uses the five // channel "Neuron" sample image. requires("1.53r"); // 1.53r21 or later setBatchMode(true); modes = newArray("Composite","Max","Min","Invert","Sum and Scale"); if (nImages>0) { getDimensions(width, height, channels, slices, frames); if (channels==1||nImages>1) close("*"); if (nImages==1) { run("Duplicate...", "duplicate"); close("\\Others"); } } if (nImages==0) run("Neuron (5 channels)"); Stack.setDisplayMode("composite"); id = getImageID(); getDimensions(width, height, channels, slices, frames); for (i=0; i1 || frames>1) run("Reduce Dimensionality...", "channels"); if (mode=="Min" || mode=="Invert") run("Invert LUTs"); run("RGB Stack"); if (mode=="Composite") { Property.set("ClipWhenSumming","true"); // clip at 255 run("Z Project...", "projection=[Sum Slices]"); } else if (mode=="Max") run("Z Project...", "projection=[Max Intensity]"); else if (mode=="Min") run("Z Project...", "projection=[Min Intensity]"); else if (mode=="Invert") { run("Invert", "stack"); Property.set("ClipWhenSumming", "true"); // clip at 255 run("Z Project...", "projection=[Sum Slices]"); run("Invert"); } else if (mode=="Sum and Scale") run("Z Project...", "projection=[Sum Slices]"); rename(mode); close("RGB"); } setBatchMode("exit and display"); run("Tile");