WAM: A Wonderfully Amazing Method for measuring the areas of red, blue staining in an RGB image using color thresholding in ImageJ. These instructions use a particular plugin called Threshold_Colour.jar. If you have installed the WCIF ImageJ bundle, this plugin is located in the Segmentation category (go to Plugins Segmentation Colour-based Thresholding). If you prefer to download plugins manually, this one can be found at http://www.dentistry.bham.ac.uk/landinig/software/software.html (scroll down to find it). Disclaimer 1: These instructions were written for a particular application: measuring areas of blue and red tissue in an image of stained tissue with a white background. Once you understand the basic principles, you should be able to modify the procedure to work for different types of images. Some of the steps (saving files, for example) are not absolutely necessary, so as you gain familiarity with the procedure, feel free to take shortcuts. Disclaimer 2: The degree of Wonderful Amazingness may vary from user to user. Starting image should be a 24-bit RGB color image, like the one below: I. SEPARATE THE COLORS 1) Open the file in ImageJ. Crop out any unusable areas if desired. 2) Open the Colour Thresholding plugin (under Segmentation in the WCIF bundle). If the HSB button is not selected, click to select it. This is usually a better way to characterize objects in a color picture. Under Filter Type, the “Pass” option should be selected for each of the three parameters (Hue, Saturation, and Brightness). 3) First we want to create an image where the pixels in the white background are set to zero. (Why? Because we are not interested in them at all and don’t want to include them in any area measurements.) To do this, click on the radio button by Invert and then drag the lower slider under the Brightness scale to the left. Notice that the whitest pixels become black as you do this. Drag the slider until only the tissue is left uncovered; all the background should now be black. If you want remove more from the light edges of the tissue, you can move the upper slider under Saturation to the right. 4) When you’re satisfied, click on the boundary of the image window to select it, then go to Image Duplicate to make another copy of the thresholded image. With the copy as the active window, go to Image Type and select “8-bit”. This will change your color image to a greyscale image. It will look something like this: 5) Save the resulting image as a new file – you will use it later to measure the total tissue area. 6) Now go back to the original RGB image and the Colour Thresholding plugin. Start playing with the sliders under the Hue window. Notice how you can eliminate everything but the red tissue by moving the upper slider to the right, selecting only the “reddish” hues (upper slider will be set to about 200, lower slider to 255). Similarly, you can eliminate everything but blue tissue by setting the upper slider to around 145 and the lower slider to around 180. If you want the red tissue only, adjust the Hue sliders until you’re satisfied. Duplicate the image as in Step 4, change the duplicate type to 8-bit, and save your red image. For the picture used above, the red image looked like this: 7) Repeat Step 6 to eliminate everything but blue tissue. When done on the image above, I get something like this: II. CONVERT IMAGES TO BINARY FORMAT Use the following procedure on every image for which you want to measure areas. 1) Open the saved greyscale image and click on Image Adjust Threshold. There are three options for displaying the threshold on the image: select “Red” for the overlay, and move the sliders until only the areas you want to measure are covered in red. Click “Apply” when you’re done, and in the window that appears, all three options should be checked. The resulting binary image will appear white in all the below-threshold (formerly dark) areas and black in all of the above –threshold areas. Here’s the binary version of the blue-only image above: Note that the thresholding step is an opportunity to be more selective in the areas you wish to measure. For example, you can eliminate the darker-stained nuclei here if you like. 2) If you like, you can go directly to stage III at this point, or you can create and save your binary images before moving to the next step. III. MEASURE AREAS 1) With the binary image active, click on Analyze Analyze Particles to open up a new window that looks like this: a. For Size, the default will be “0 – Infinity”, and the units will either be square pixels (if the actual image size is unknown) or square units of length (inches, microns, etc, if the image size is known). Set the limits to exclude things that are too small (like the little black flecks in the picture above) or too large. b. Circularity: this can be set to select only round objects or only long, linear objects by adjusting the range (1.00 = perfectly circular, 0.00 = a straight line). If the shape is unimportant, leave Circularity unchanged. c. Show: select the type of image you’d like to generate upon measurement. “Masks” will generate a binary mask showing the shapes of the objects found. “Outlines” will generate a white page with only the outlines of the found objects drawn. “Ellipses” will generate a white page with ellipses surrounding the area found (the actual areas will not be shown). d. The checkboxes on the left tell the program whether or not to display measured areas or a summary in new windows. The checkboxes on the right tell the program whether or not to exclude areas touching the edges of the image, whether or not to include holes in the area measured, and whether or not to record data (“Starts”) to be used by another macro or plugin. Using the above settings on the blue binary image yields the following: Slightly different settings like these: yield slightly different results: The results window will show all measurements done on the binary image. Select which measurements are done by going to Analyze Set Measurements before you begin. You can save the summary and measurement results in a text file for later use.