RegionParams Table


The RegionParams table contains properties used by the CMeasureRegions class. This table is used to change properties using the class SetParams method.

The reference table below lists the region measurement properties and their update status. For each property in the top half of the table, there exists a corresponding update status flag in the lower half of the table. The name of the update status flag prefixes the property name with the word Set. For example, the property bCentroid has the update status flag bSetCentroid. Normally, the update status flag is set to false. But to change it using the RegionParams table, you must the the status flag to true. Create an RegionParams table containing only the properties you wish to change. Then call the class SetParams method with the RegionParams table as its parameter.

Table Member

Default

Definition

Property:

 

 

sColor

"255,0,0"

The color of the line. See the nRasterOp property.

nRasterOp

13

Controls the way the line color and image color are combined for drawing.

nLineThk

1

Sets the thickness of the line, in pixels, drawn on the image.

bFilled

true

Draws the region filled (true) or outlined (false).

nMatchingTol

3

Sets the tolerance, in pixels, for mouse click "hits" to the line.

nClosureTol

3

Sets the tolerance, in pixels, for clicking on the endpoint of the polygon.

nCentroidRadius

15

The centroid radius when the vertex is adjusted to the centroid coordinates.

nTrackingSearchRadius

15

Specifies the tracking radius when transferring angle marker coordinates to the next image in the image set.

bCentroid

false

Specifies whether each vertex coordinate is updated to centroid coordinates before drawing on the image.

bCentroidPositive

false

Specifies whether the centroid calculation assumes the object has positive (true) or negative (false) values relative to the background.

bCentroidAfterMove

false

Specifies whether each vertex coordinate is updated to centroid coordinates before drawing on the image.

bCentroidTrack

false

Specifies whether the centroid is computed for the vertex when transferring region markers from one image to the next.

bUseDockingPane

false

Specifies whether to list region measurements (area, mean, etc.) in a docking pane (true) instead of a measurement window (false).

Update Status:

 

 

bSetColor

false

Enables changes to sColor.

bSetRasterOp

false

Enables changes to nRasterOp.

bSetLineThk

false

Enables changes to nLineThk.

bSetFilled

false

Enabled canges to bFilled.

bSetMatchingTol

false

Enables changes to nMatchingTol.

bSetClosureTol

false

Enables changes to nClosureTol.

bSetCentroidRadius

false

Enables changes to nCentroidRadius.

bSetTrackingSearchRadius

false

Enables changes to nTrackingSearchRadius.

bSetCentroid

false

Enables changes to bCentroid.

bSetCentroidPositive

false

Enables changes to bCentroidPositive.

bSetCentroidAfterMove

false

Enables changes to bCentroidAfterMove.

bSetCentroidTrack

false

Enables changes to bCentroidTrack.

bSetUseDockingPane

false

Enables changes to bUseDockingPane.

Example

Suppose an image window exists on the Mira screen and you have a collection of x,y points that define a polygon to be drawn on the image. The script below sets the drawing color and line thickness before drawing a region on the image.

V = attachlist_imageview()

-- attach an image window

Assert( V, "No image window")

-- leave script if no image window

 

 

I = V:GetImage()

-- get the top-most or only image

Assert( I, "No image selected")

-- leave script if no image

 

 

R = new_measureregions()

-- create a CMeasureRegions object

Params =

-- setup an RegionParams table

{

-- use a comma after each "name=value" pair

  bSetColor = true,

-- enable new marker color

  sColor = "0,255,0",

 

  bSetLineThk = true,

-- enable new line thickness

  nLineThk = 2,

 

}

 

R:SetParams(Params)

-- set the new properties

 

 

tbl = {}

-- create a table to hold points

tbl[1] = 400

-- x[1]

tbl[2] = 500

-- y[1]

tbl[3] = 612

-- x[2]

tbl[4] = 480

-- y[2]

-- add more vertex points

 

R:Add(I, tbl)

-- Add a region marker to the image

Related Topics

CMeasureRegions class, SetParams


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.