Help with imageJ

This page has 12 images, so it may take a while to load


On this page I introduce you to imageJ and show, after brief introduction to installing the software or accessing via browser, how to get simple measures of length and area from a digital image.

From time to time we need to extract data from images. Today, we mostly work from digital images. This post is not about how to acquire good quality images suitable for “science,” but instead briefly introduces you to free software that can be used to extract data from images.

Working with digital images requires image processing software. Some of you have already been introduced to Nikon NX Studio for microscopy (NX Studio is now free with registration to download). Non commercial versions also exist, for example, ImageJ. ImageJ is open-source and free to use. Plug-ins have been written by many users to extend the function of ImageJ — I therefore prefer to download and install Fiji (which stands for Fiji is just ImageJ) because Fiji comes with many useful plugins already installed and added to the basic ImageJ program. You can choose to run imageJ in your browser, or install to your computer. Both work although you may find that an installed imageJ on your computer will behave better than the browser version.

Run imageJ in your browser

Recently, the good folks who support imageJ have made a version that can be run in your browser, which means you don’t have to install the software onto your computer. For occasional use, the browser version is the way to go. If you analyze images often, install imageJ to your computer. You may access the browser version directly at https://ij.imjoy.io/,  or from links at imageJ website .

Install to your computer

Downloading ImageJ or Fiji for your computer. Decide which software you want

ImageJ (and therefore Fiji) is written in Java, and so can be run on any operating system (e.g., macOS or Windows 10) provided a current “Java run time environment” or “JRE” is installed. If you don’t know what this means, then you can either check to see if your computer has a JRE installed, or try to install and run ImageJ without the included JRE (it’s a smaller download) — if ImageJ won’t run, you’ll need the JRE. The instructions are the same for Fiji.

Popup menus in browser version of imageJ may hide important functions

The principles described on this page are the same whether you use imageJ online (in your browser) or installed to your computer. However, I have noticed the popup windows in the browser version may hide some of the functions. For example, to measure lengths we need to convert from number of pixels to units of inches or centimeters. We do this by including a size marker on the image, then call up the Set Scale menu in imageJ (Fig. 1).

When you set the scale, the popup window hides “OK” button (Fig. 1), which you need to click to save the settings.

Screenshot of browser version imageJ, note "OK" button is no visible

Figure 1. Screenshot of browser version imageJ, note “OK” button is no visible.

To solve this, hover your mouse over the lower right corner to bring up a double white arrow (Fig. 2)

Figure 2. Screenshot of Set Scale menu, browser version of imageJ. Hover mouse over lower left corner and double arrow will show. Hold left-click and drag down to reveal full menu (Fig. 3). Note I added the double arrow and enlarged it for emphasis.

Figure 3. Screenshot of Set Scale, browser version, which shows full menu. 

In order to save settings, you need to click OK after making changes.

Measuring lengths or areas from an image

ImageJ can do lots of things. Here, we introduce only how to record lengths and to calculate areas of interest in numbers of pixels and calibrated units (inches, centimeters, etc.). We’ll use an image of a dart board with three thrown darts. We’ll define two measures: distance in inches between the dart and the center of the board (Length) and the area in squared inches defined by the three darts (Area). An example image is shown in Figure 4.

Note that a more detailed and complete set of instructions for working with the targets is available in SOP_ImageJ_lines.pdf. The instructions below are just here to demonstrate basic imageJ features.

Figure 4. Dartboard inelegantly taped to a metal cabinet door. Note the five inch scale bar at lower left. Alternatively, the diameter of the dartboard was 16 inches. 

Step 1. Start ImageJ (or Fiji). Screenshot of Fiji running on a macOS computer is shown in Figure 5.

Figure 5. Fiji running on macOS High Sierra

Step 2. Load the image file into ImageJ. File → Open

Step 3. Set the scale to relate pixel count to distance in inches.

  • Click on the Line segment tool (Figure 6, red arrow points to the tool)
  • Point to the spot/line on the image with known length (e.g., the 5 inch line or the width of the dart board — in this example, the diameter of the board will be the target).
  • Click and drag the line across the entire length of the known distance (Figure 7).

Figure6. Fiji line segment tool shown

Figure 7. Line drawn to known distance on image, the diameter of the dartboard (16 inches).

Next, select Analyze → Set Scale from the Fiji menu and enter the known distance and set the scale to global (Figure 8).

Before setting the scale information

After setting the scale information

Figure 8. Left, the popup menu with default entries; at right, after the parameters have been entered.

At the end of step 3 you have calibrated number of pixels to number of inches and set the scale for all subsequent measures (global).

Step 4. Return to the image and with the line segment tool selected, draw a line between a dart and the board center (Figure 9).

Figure 9. Length of distance between dart and center of board.

Step 5. From the menu, select Analyze → Measure. Default measures will be made by ImageJ and show in the Results window (Figure 10). The distance between the dart location and the center of the board is 5.4 inches.

Figure 10. Screenshot of results window

Step 6. Repeat step 4 and 5 for each dart. I get 5.984 and 5.284 inches for dart 2 and dart 3, respectively.

Step 7. To get the area as a measure of dart spread, select the polygon tool from the menu (Figure 11, blue arrow).

Figure 11. Screenshot of imageJ menu bar, blue arrow points to polygon selection tool.

Click on the first dart to activate the polygon selection tool, then draw towards the second and third darts, ending back on the first dart. Double click to end. A triangle shape should be visible (Figure 12).

Figure 12. Screenshot of selected polygon region

Step 8. From the menu, select Analyze → Measure. Default measures will be made by ImageJ and show in the Results window (not shown). The area of the polygon is 36.703 inches squared.

/MD