Overview of Working with ROIs
A region of interest (ROI) is an area of an image defined for further analysis or processing. There are several ways to define ROIs. The XROI utility enables the interactive definition of single or multiple regions from an image using the mouse. Routines such as CONTOUR or REGION_GROW enable the programmatic definition of ROIS. CONTOUR traces the outlines of thresholded ROIs while the REGION_GROW routine expands an initial region to include all connected, neighboring pixels that meet given conditions. Once an ROI is defined, it can be displayed or undergo further analysis.
An ROI can be displayed using either Direct Graphics or Object Graphics. In Direct Graphics, the DRAW_ROI routine quickly displays single or multiple ROI objects or an ROI group. In Object Graphics, see IDLanROI and IDLgrROI in the IDL Reference Guide for more information.
Note
When computing ROI geometry, there is a difference between a region's area when it is displayed on a screen versus the region's computed, geometric area. See Contrasting an ROI's Geometric Area and Mask Area for details.
Multiple ROIs can also be defined from a multi-image data set and added to an IDLanROIGroup object for triangulation into a 3D mesh. Alternatively, multiple ROIs can be defined in a single image and added to a group object. ROI groups can be displayed in a Direct Graphics window with DRAW_ROI or with the Object Graphics XOBJVIEW utility.
The following table introduces the tasks and routines covered in this chapter.
|
Task
|
Routine(s)/Object(s)
|
Description
|
|---|---|---|
| Create an ROI interactively, prior to analysis or display. |
||
| Display ROI objects in a Direct Graphics window. |
||
|
CONTOUR |
Define ROIs using CONTOUR and display them using DRAW_ROI. Return various statistics for each ROI. |
|
| Expand an original region to include all connected, neighboring pixels which meet specified constraints. |
||
| Create a 2D mask of an ROI, compute the area of the mask and display a magnified view of the image region. |
||
| Determine whether a point lies within the boundary of a region. |
||
| Add ROIs to an ROI group object, triangulate a surface mesh and display the group object using XOBJVIEW. |
Contrasting an ROI's Geometric Area and Mask Area
When working with ROIs, many users note a discrepancy between the computation of an ROI's geometric area and the computation of the mask area (the number of pixels an ROI contains when displayed). Intuition might lead one to believe that the results should be the same. However, as the following figure shows, the computed geometric area (the result of a pure mathematical calculation) differs from the displayed (masked) area, which is subject to the artifacts of digital sampling.
When displaying a region (or computing the area of its mask), each vertex of the region is mapped to a corresponding discrete pixel location. No matter where the vertex falls within the pixel, the entire pixel location is set since the region is being displayed. For example, for any vertex coordinate (x, y) where:
1.5 ≤ x < 2.5 and 1.5 ≤ y < 2.5
the vertex coordinate is assigned a value of (2, 2). Therefore, the area of the displayed (masked) region is typically larger than the computed geometric area. While the geometric area of a 2 by 2 region equals 4 as expected, the mask area of the identical region equals 9 due to the centering of the pixels when the region is displayed.
The ROI Information dialog of the XROI utility reports the region's "Area" (geometric area) and "# Pixels" (mask area). To programmatically compute an ROI's geometric area, use IDLanROI::ComputeGeometry. To programmatically compute the area of a displayed region, use IDLanROI::ComputeMask in conjunction with IMAGE_STATISTICS. See Programmatically Defining ROIs for examples of these computations.
