CMeasureRegions:SetParams


The SetParams method changes the properties for regions drawn on an image. Region properties are initialized to reasonable values by the class. The purpose of this method is to change the properties by setting values in the RegionParams table. See the Mira User's Guide for more information under the main topic Measuring Images.

Syntax

bSuccess = CMeasureRegions:SetParams( RegionParams_table)

bullet.gif    where RegionParams_table is a table of type RegionParams containing properties to change.

bullet.gif    On success, true is returned.

Example

Suppose an image window exists on the Mira screen and you wish to draw a region on the image. The script below changes several drawing properties from default values. Note that your table does not need to be named Params.

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 a 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,

 

  bSetFilled = true,

-- enable drawing a filled region

  bFilled = true

 

}

 

R:SetParams(Params)

-- set the new properties

 

 

tblData = {}

-- create a table for x and y coordinates

tblData[1] = xc - 200

-- x1

tblData[2] = yc + 50

-- y1

tblData[3] = xc + 150

-- x2

tblData[4] = yc + 220

-- y2

tblData[5] = xc + 280

-- etc.

tblData[6] = yc - 100

 

tblData[7] = xc - 100

 

tblData[8] = yc - 80

 

 

 

bSuccess = R:Add( I, tblData )

-- Add the measurement to the image

Related Topics

CMeasureRegions class, Add, RegionParams table


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