August 11, 2010 UTK Skills for Success Workshop

Adapted from Counting Sheep: Image Analysis by Claudia Neuhauser and Getting Started with Image Analysis E. Stanley & P. Whitaker

Introduction to Using ImageJ

ImageJ is a NIH resource for processing and analyzing images. The software can be downloaded from the ImageJ web site: http://rsbweb.nih.gov/ij/

The documentation can be found at http://rsbweb.nih.gov/ij/docs/index.html

More tutorials are found at: http://rsbweb.nih.gov/ij/docs/examples/index.html

Learning Objectives

You will be able to

  • load images into ImageJ
  • prepare images for image analysis
  • perform simple image analysis (counting and measuring)
  • save image data to excel files

Knowledge and Skills

  • using imaging software for image analysis
  • mathematical concepts: scale, circularity
  • measurement of area and length for objects
  • count objects within the image

Introduction

ImageJ is a public domain software that can be downloaded on a variety of platforms, including Windows and Mac. The software can convert many image formats including GIF, JPEG, and TIFF to to 8-bit, 16-bit, or 32-bit images, which can then be analyzed by ImageJ.

We will use ImageJ to measure distances and count objects. Since TIFF is the least degradable format when an image is repeatedly used for analysis, it is recommended to save any image first as TIFF before conversion to 8-bit, 16-bit, or 32-bit.

Measuring Objects

Measuring objects and setting scale is useful in any image analysis. We will start by measuring the length of hemlock (Tsuga) leaves in a photograph. Load the image hemlock_leaves.jpg

Use the straight line tool (5 squares in from the left) in the toolbar to measure the scale bar in the bottom right. Once a straight line is drawn, choose Analyze from the menu bar and click on Measure.Now select Set Scaleand enter the Known Distanceas 10 and then the Unit of Length as mm. Click on Global and OK to record further measurements.

Use the straight line tool to determine the length of each of three leaves. You will need to Measure each for the record to appear in the results table. Save this table so the lengths will be saved in an Excel file.

1. Leaf 1

2. Leaf 2

3. Leaf 3

Counting Objects

To learn how to count objects, we will count the number of stomata in a micrograph of a hemlock leaf. Load the image hemlock.gif.

What do you notice about the arrangement of stomata in this image?

How can you account for this?

The image is in GIF format. We will change it to a black and white bit format before we use the tools within ImageJ: Image > Type > 8-bit

To segment the image into the objects of interest and the background, we use thresholding

ImageAdjustThreshold

A dialog box pops up where we can adjust the threshold so that only the pixels of the objects of interest appear. Choose B/W (Black & White) in the drop down menu within the dialog box. Click Apply. The image will change into a black and white picture. Adjust the sliders so that the pixels of the objects of interest stand out as black ovals.

To count the objects, we use the Analyze menu

AnalyzeAnalyze Particles

A dialog box pops up where we need to enter the Size and Circularity of the objects, and what we want to show. In order to count only particles above a certain number of pixels, enter a single value into the Size field. Particles smaller than that value will be ignored. For this image, set Size at 400. (Note: You may need to set the size units as pixels.)

Now we need to consider the shape of the particle to be counted. If the object is circular, the value of the quantity Circularity is equal to 1. Stomata are not completely round when viewed from above, so we need to adjust the circularity.

To understand the concept of circularity, we can look at ellipses with different values of the major radius a and minor radius b. The area of an ellipse is equal to . There is no simple formula for the perimeter of an ellipse. But circularity is approximately:

The following table provides values for circularity for different increasingly flattened ellipses:

a / b / C
1 / 1 / 1.00
2 / 1 / 0.80
3 / 1 / 0.60
4 / 1 / 0.47
5 / 1 / 0.38
6 / 1 / 0.32

After you enter Size and Circularity into the dialog box, check Pixel units,Display, Clear, Exclude Edges, and Include Holes. Use 0.20 as the value for Circularity.

Count 1: ______

Note: You can increase the accuracy of your total count in more difficult images by fine adjustments to the threshold or changes in size and circularity.

Save your results by selecting the results window and choosing save under File in the menu. Note your data is in an Excel file. Note the area value for each stoma. (What does this tell you?)

How many stomata?

Partitioning the image and counting by hand reveals 22 stomata not touching the borders.

1