CLabels:SetParams


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

Syntax

bSuccess = CLabels:SetParams( LabelParams_table)

bullet.gif    where LabelParams_table is a table of type LabelParams containing properties to change.

bullet.gif    On success, true is returned.

Example

Suppose an image window exists on the Mira screen and you have a collection of object coordinates you wish to label on the image. The script below changes the marker size, drawing color, and line thickness from default values. Note that your table does not need to be named Params. Also, the values of x, y, and str do not need to be explicitly defined and could be included as parameters in the call to Add.

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

 

 

L = new_labels()

-- create a CLabels object

Params =

-- setup a LabelParams table

{

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

  bSetColor = true,

-- enable new marker color

  sColor = "0,255,0",

 

  bSetMarkerSize = true,

-- enable new marker size

  nMarkerSize = 65,

 

  bSetLineThk = true,

-- enable new line thickness

  nLineThk = 2,

 

  bSetCentroid = true,

-- enable changing the centroid

  bCentroid = true,

-- centroid the initial coordinates

}

 

L:SetParams(Params)

-- set the new properties

-- x and y are the initial coordinates:

 

x = 300; y = 7500; str = "my label"

-- coordinates and title

L:Add(I, x, y, str)

-- Add a label to the image

Related Topics

CLabels class, Add, LabelParams table


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