// Intensity-Color overlay image // Given an intensity image (grayscale) and an image with a fancy colored lookup table. // This macro will take the intensity image as pixel brightness and encode // the color from the colorful image underneath the intensity of each pixel. // Written by Wilson R Adams | Vanderbilt Biophotonics Center | Jan 2021 // ========================================================================== // User Interface winlist = getList("image.titles"); Dialog.create("Intensity - Color Overlay Macro"); Dialog.addMessage("Select the images you want to overlay"); Dialog.addChoice("Intensity Image", winlist); Dialog.addChoice("Color Image", winlist); Dialog.show(); int = Dialog.getChoice(); // Intensity Image Variable color = Dialog.getChoice(); // Color Image Variable //print(int); //print(color); IntColorOverlay(int, color) // === Overlay Process === // Max normalize intensity image function IntColorOverlay(int, col) { // // Given an intensity image (grayscale) and an image with a fancy colored lookup table. // This macro will take the intensity image as pixel brightness and encode // the color from the colorful image underneath the intensity of each pixel. // Written by Wilson R Adams | Vanderbilt Biophotonics Center | Jan 2021 selectWindow(int); run("Duplicate...", "inttemp"); inttemp = getTitle(); getStatistics(area, mean, min, max, std, histogram); run("32-bit"); // Make into floating point decimal run("Divide...", "value=&max"); // Prepare Color image as RGB stack selectWindow(color); run("Duplicate...", "coltemp"); run("16-bit"); run("RGB Color"); coltemp1 = getTitle(); run("RGB Stack"); coltemp = getTitle(); // Multiply images into a 32bit, 3 frame result imageCalculator("Multiply create stack", coltemp, inttemp); result = getTitle() run("Stack to RGB"); rename(int+"_coloroverlay") close(result) close(coltemp1); close(coltemp); close(inttemp); }