The IDLanROI::ComputeGeometry function method computes the geometrical values for area, perimeter, and/or centroid of the region.
Syntax
Result = Obj>[IDLanROI::]ComputeGeometry( [, AREA=variable] [, CENTROID=variable] [, PERIMETER=variable] [, SPATIAL_OFFSET=vector] [, SPATIAL_SCALE=vector] )
Return Value
Result
This function method returns a 1 for success, or a 0 for failure. Each computed value is returned in the variable name assigned to each keyword.
Arguments
None.
Keywords
AREA
Set this keyword to a named variable that upon return contains a doubleprecision floatingpoint value representing the area of the region. Interior regions (holes) return a negative area.
Note that the computed area represents the geometric area described by the region’s vertex data. A pixelbased area can be computed as follows:

Compute a mask for the region.
mask = oROI>ComputeMask()

Call IMAGE_STATISTICS to count number of samples within the mask.
IMAGE_STATISTICS, myImage, MASK = mask, COUNT = nSamples

Compute pixel area.
pixelArea = nSamples * pixelXSize * pixelYSize
CENTROID
Set this keyword to a named variable that upon return contains a doubleprecision floatingpoint vector [x,y,z] representing the centroid for the region. If the TYPE of the region is 0 (points), the centroid is computed as the average of each of the vertices in the region. If the TYPE of the region is 1 (path), the centroid is computed as the weighted average of each of the midpoints of the lines in the region. Weights are proportional to the length of the lines. If the TYPE of the region is 2 (polygon), the centroid is computed as a weighted average of the centroids of the polygons making up the ROI (interior centroids use negative weights). Weights are proportional to the polygon area.
PERIMETER
Set this keyword to a named variable that upon return contains a doubleprecision floatingpoint value representing the perimeter of the region.
SPATIAL_OFFSET
Set this keyword to a two or threeelement vector, [tx, ty] or [tx, ty, tz], representing the spatial calibration offset factors to be applied for the geometry calculations. The value of SPATIAL_SCALE is applied before the spatial offset values are applied. The default is [0.0, 0.0, 0.0]. IDL converts and maintains this value in doubleprecision floatingpoint.
SPATIAL_SCALE
Set this keyword to a two or threeelement vector, [sx, sy] or [sx, sy, sz], representing the spatial calibration scaling factors to be applied for the geometry calculations. The spatial calibration scale is applied first, then the value of SPATIAL_OFFSET is applied. The default is [1.0, 1.0, 1.0]. IDL converts and maintains this value in doubleprecision floatingpoint.
Version History