// ---------------------------Dialog box 0-------------------------------- waitForUser("Intensity Modulated Display...", "Open the numerator image and denominator image.\nThen press OK..."); openimages = newArray(nImages); for (i=0; i < openimages.length; i++) { selectImage(i+1); // selects (i+1)st image openimages[i] = getTitle(); } // openimages = getList("image.titles"); //THIS FUNCTION DOES NOT WORK!! // ---------------------------Dialog box 1-------------------------------- Dialog.create("Create Intensity Modulated Display..."); Dialog.addChoice("Select Numerator Image: ", openimages); Dialog.addChoice("Select Denominator Image: ", openimages); Dialog.addCheckbox("Smooth prior to division? ", true); Dialog.show(); numimg = Dialog.getChoice(); denimg = Dialog.getChoice(); smooth = Dialog.getCheckbox(); //Creates ratio image... if (smooth == true) { selectWindow(numimg); run("8-bit"); run("Gaussian Blur...", "sigma=1"); selectWindow(denimg); run("8-bit"); run("Gaussian Blur...", "sigma=1"); imageCalculator("Divide create 32-bit", numimg, denimg); ratioimg = getTitle(); selectWindow(numimg); //Keep denom image to use for brightness close(); } if (smooth == false) { selectWindow(numimg); run("8-bit"); selectWindow(denimg); run("8-bit"); imageCalculator("Divide create 32-bit", numimg, denimg); ratioimg = getTitle(); selectWindow(numimg); //Keep denom image to use for brightness close(); } // ---------------------------Dialog box 2-------------------------------- //Finds the max value in the ratio image... selectWindow(ratioimg); run("Enhance Contrast", "saturated=0.1"); getMinAndMax(min, absmax); //Suggest a max value to display in the ratio image based on its histogram.... run("Enhance Contrast", "saturated=1.00"); getMinAndMax(min, sugmax); Dialog.create("Set Scale..."); Dialog.addSlider("Set maximum displayed value in ratio image: ", 0, absmax, sugmax); Dialog.addSlider("Set % saturation in denominator image: ", 0.5, 5, 1); Dialog.show(); usermax = Dialog.getNumber(); usersat = Dialog.getNumber(); selectWindow(ratioimg); setMinAndMax(0, usermax); // max as selected by user run("8-bit"); run("Invert"); //Makes high ratios hot and low ratios cool (inherently, red hue = 0 -> blue hue = 170) run("Multiply...", "value=0.666"); // Contstrains hues from 0-170 to match calibration bar (so only red->blue colors are shown) selectWindow(denimg); run("Enhance Contrast", "saturated="+usersat); // as selected by user run("8-bit"); //----------------------Creates HSB Image ------------------------------------- selectWindow(ratioimg); getDimensions(ratioimgwidth, ratioimgheight, channels, slices, frames); //Creates an HSB image... THIS IS THE ONLY WAY TO DO IT!! newImage("HSB", "RGB black", ratioimgwidth, ratioimgheight, 1); run("HSB Stack"); //Copies the ratio image into the hue channel of the HSB Stack selectWindow(ratioimg); run("Select All"); run("Copy"); run("Close"); selectWindow("HSB"); setSlice(1); run("Paste"); //Creates the Saturation (constant) image newImage("Sat", "8-bit white", ratioimgwidth, ratioimgheight, 1); //Copies the Sat image into the Sat channel of the HSB Stack selectWindow("Sat"); run("Select All"); run("Copy"); run("Close"); selectWindow("HSB"); setSlice(2); run("Paste"); //Copies the denominator image into the brightness channel of the HSB Stack selectWindow(denimg); run("Select All"); run("Copy"); run("Close"); selectWindow("HSB"); setSlice(3); run("Paste"); //Turns the HSB values into an RGB image run("RGB Color"); run("Select None");