Initial Publication Date: July 20, 2011

Part 2: Manage Regions of Interest (ROI) and Annotate Images3

Now that you are an expert on the selecting tools, you may be wondering what you can do with this new-found knowledge. On days 4 and 5 you will be simulating the workflow of a professional research project involving changes in Arctic Sea Ice over time. The goal of the investigation is to measure and graph changes in the monthly average Arctic Sea Ice extent over a period of several years, and for several specific study regions. You may already be familiar with the data used in the investigation, but the workflow will be quite different from what you may have done in the past. It will hinge on a very powerful organizational tool built into ImageJ called the ROI Manager. As you recall, ROI stands for "Region Of Interest"just a fancy name for a selection.

Before working with the ROI Manager, it's helpful to be aware of some of the other things you can do to manipulate selections (ROIs).

The Selection Submenu

A number of useful selection-related functions are found under the Edit > Selection submenu.

Use the Pasadena image to make a selection, then see what each of these ROI Manipulations does:

  • Fit Spline Fits a cubic spline curve to a polygon or polyline (segmented line) selection.
  • Fit Circle Fits a circle to a multipoint, segmented line, angle, or area selection. With closed shapes, the circle has the same area and centroid (center) as the original selection.
  • Fit Ellipse Replaces an area selection with the best fit ellipse. The ellipse will have the same area, orientation, and centroid as the original selection.
  • Convex Hull Replaces a polygon or freehand selection with its convex hull. Think of drawing the polygon on a board, pounding in nails at each vertex, and putting a rubber band around the nails. The polygon shape made by the rubber band is a convex hull.
  • Make Inverse Creates an inverse selection. The pixels that were outside the selection are all now inside the selection. This is very useful when you want to make measurements of the pixels in complementary regions of the image. (Green versus not green, for example. Select the green pixels, then choose Make Inverse to select the non-green pixels.)
  • Create Selection Creates a selection from a thresholded image.
  • Create Mask Creates a new 8-bit image called "Mask" whose pixels have a value of 255 inside the selection and 0 outside the selection.
  • Properties Opens a dialog box that lets you set the stroke (line) color, fill color, and width of the selection outline. The available selection colors are black, white, cyan, magenta, yellow, red, green, blue, and orange.
  • Rotate Rotates a selection the specified number of degrees.
  • Enlarge Grows (expands) a selection by a specified number of pixels. Positive values make the selection larger and negative values make it smaller.
  • Make Band Takes an area selection and makes a band around the perimeter a specified number of pixels wide. For example, if you select a circle then choose Make Band, the selection will resemble a donut (D'oh!)
  • Specify Opens a dialog box that lets you specify the height, width, and location of a rectangular or oval selection.
  • Straighten Straightens curved selections made with the segmented line selection tool.
    • Open the NileBend sample image.
    • Use the segmented line tool to trace the route of the river.
    • Choose Selection > Straighten (and be amazed).
  • To Bounding Box Converts a non-rectangular selection to the smallest rectangle selection that would completely contain the original selection.
  • Line to Area Converts a line selection more than one pixel wide to a traced outline.
  • Area to Line Converts an area selection to a line selection by removing the last segment completed while making the selection.

The ROI Manager

The ROI (Region Of Interest) Manager is a handy utility that not only helps you to save and keep track of different selected regions, but it includes powerful set operations (union, intersection, etc.) that can accomplish difficult and tedious tasks in a couple of clicks. There won't be time to thoroughly explore all its capabilities, but you should get a hint of what the ROI Manager can do.

  • Still working with the Pasadena aerial image, zoom in on the building shown here.

    If you wanted to select the outline of this building, you could do it as a compound selection by adding together selections made with the rectangle and circle tools, which would require pressing and releasing modifier keys at just the right time or you mess it up and have to start over again. Sounds like fun, right? This is a perfect task to accomplish using the ROI Manager.
     
  • Use the rectangular selection tool to select the large rectangular section on the left.
  • Choose Edit > Selection > Add to Manager or use its keyboard shortcut. This opens the ROI Manager window, which lists the selection you just made with a serial number.
  • Click anywhere outside the selection rectangle on the image to cancel the rectangular selection.
  • In the ROI Manager window, click the serial number of the selection in the left-hand column. Voila the selection isn't gone, it's just being managed!
  • The serial number isn't very useful for identifying the selection, so click the Rename button in the ROI Manager window and give the selection a catchy name like "Rectangle 1".
  • Using the rectangle tool, select the other large rectangular section on top. Make sure the bottom edge extends all the way down to the point where the curved outer wall begins.
  • Add the second selection to the ROI Manager and name it Rectangle 2.
  • Make a third rectangular selection to join these two parts of the building together. Make sure this selection overlaps the areas covered by the other two by a little. Add this selection to the ROI Manager and rename it.
  • Make a circular selection of the round part of the building, selecting from the center of the smaller circle on the roof. (Use modifier keys to select the circle from the center!) Add the selection to the ROI Manager and rename it.
  • In the ROI Manager, click your way down the list on the left and watch each of your four ROIs light up.
  • What we want is to select the whole building at once. Drag down the list or shift-click to select all four named ROIs. Only one will appear active on the image. If you check the Show All option at the bottom of the ROI Manager window all four ROIs will appear.
  • To merge the four selections into one, click the More button at the bottom of the ROI Manager and choose the Or (Combine) option from the pop-up menu.
  • Uncheck the Show All option. You should now see a single outline around the building.
  • Click the Add button to add this new selection to the ROI Manager, and rename it. If you don't need the four smaller selections, you can delete them from the ROI Manager. Just highlight and click Delete.
  • Now you can do anything with this selection that you wantuse it to draw the building's outline, measure the roof area, save the ROI file (Open and Save are both on the More popup menu), transfer the ROI to a different image, and much more.
  • If you want to try downloading and opening a ROI file in ImageJ, here's the one created for this exercise. Building Footprint ROI (Zip Archive 397bytes Jul20 11)

Image Annotation

Annotation is the process of adding (drawing) points, lines, arrows, shapes, and text on images to identify important features or provide additional information about the image. There are two basic types of annotationdestructive and non-destructive.

Destructive Annotation

Destructive annotation is named for the fact that you are drawing directly on the image. In other words, you are replacing the original pixel data with new pixel values that represent the colors of the graphic elements you are adding. This is fine for any work where you do not need to get at the original image data. Tip: Always work on a copy of your image and keep an original or untouched copy in a safe place. Destructive annotation can't be undone.

For every point, line, arrow, or shape you want to add:

  • Make a selection
  • To set the drawing color, double-click the color picker tool on the ImageJ toolbar and choose a foreground color.
  • To set the width of line selections, choose Edit > Options > Line Width.
  • Choose Edit > Draw to draw the point(s), line, or shape outline in the color and width you specified.
  • Choose Edit > Fill to fill area selections with the foreground color.
  • Choose Edit > Clear to fill inside the selection with the background color, which is usually white.

To add text annotations.

  • Double-click the Text tool to open the font options dialog box:
  • Set the Font, Size, Style, and smoothing option.
  • Text is drawn in the foreground color. Set the text color if necessary. (Tip: The foreground color is the color that appears in the eyedropper icon for the color picker button on the toolbar.)
  • Click on the image where you want to place the text (it doesn't have to be exact, you can move the text selection anywhere at any time as long as the selection remains active. You can even change the font settings and color.)
  • When you have the text element the way you want it, choose Edit > Draw. The text is drawn on the image in the foreground color.
  • Don't forget elements like scale bars and calibration barsyou should have learned how to add those in an earlier exercise.

Non-Destructive Annotation

 

In non-destructive annotation, the graphic elements (Including other images) are added to a transparent overlay layer, and this layer can be turned on or off. The process is virtually identical to destructive annotation, except:

  • Make the selection, then choose Image > Overlay > Add Selection. If your selection was a point, line, or shape, you will see this dialog box. Make the appropriate settings and click OK to add the selection to the overlay.

  • If the selection is text, you will see this dialog box. Make the appropriate settings and click OK to add the selection to the overlay.

  • Caution: There is only one overlayif you check the New overlay option, everything on the current overlay will be lost.
  • The only image format that supports the overlays is TIFF. If you are working with an annotated image and don't want it "flattened" (converted from non-destructive to destructive by moving the graphic elements from the overlay and drawing them on the image.
  • You can't really edit your overlay. If you make a mistake, you pretty much need to delete it and start over. However, if you build up the elements of your overlays using the ROI Manager, you can get the elements "just right" before you add them to the overlay. Note the two items on the Image > Overlay submenu: From ROI Manager and To ROI Manager.
  • Always use Hide Overlay and to turn the overlay display on and off.
  • Remove Overlay deletes the overlay layer.
  • Flatten merges the overlay with the image. This is useful when you need to save the image in a format that does not support overlays (basically, everything except TIFF.)

Your Assignment: Define Study Areas and Save Them As Regions of Interest (ROI)

  1. Go to [link https://neo.gsfc.nasa.gov/ 'NEO (NASA Earth Observations)' new] and download two images of interest to you. Make sure they are the same size. Choose two different datasets that make sense to compare.
  2. Spatially calibrate each image.
  3. Choose one of the images to define and select three study areas. Save and label each selection as to the Region of Interest (ROI) Manager.
  4. Open and apply the ROI to the second image and measure the areas.
  5. Use an overlay to annotate your image.
  6. Take a screen shot showing your images with selections along with the Results window and post it to the Part 2: Share and Discuss Page. Then describe as much as you can about what you analyzed.
  7. Engage in an online discussion, sharing your ideas about using Regions of Interest (ROI) in classroom investigations.

Source

1Adapted from Earth Exploration Toolbook chapter instructions under Creative Commons license Attribution-NonCommercial-ShareAlike 1.0.
2Adapted from Eyes in the Sky II online course materials, Copyright 2010, TERC. All rights reserved.
3New material developed for Earth Analysis Techniques, Copyright 2011, TERC. All rights reserved.