CLabels:Add
The Add method creates a text label on an image like that shown below. The script that create this is given in the Examples section.
|
|
bSuccess = CLabels:Add( CImage, x, y, str ) |
CImage specifies the target image where the label will be drawn.
x,y specifies the pixel coordinates for the label, beginning at (1,1).
str is the text of the label.
On success, true is returned.
If the method fails or the CImageView is nil, then false is returned.
This method draws a label on a displayed image, a CImage, attached to a CImageView object. The label consists of a marker and a text string. The marker and text string are both optional. If the text string spans multiple lines, the string should be formatted using \r\n escape characters between lines (see example below). The SetParams method can also be used to choose the label attributes before labels are added. See the Mira User's Guide for further information about adding labels to images.
The label attributes and the label text can be changed after the label is created by using the buttons on the Label toolbar on the image window. See the Mira User's Guide for further information.
This example produced the result shown above. The following script opens multiple images into a window, then tracks a centroid position through the image set. A label containing the centroid coordinates is drawn at each position on each image. After each image, the centroid coordinates are used as starting coordinates in the Calc method for computing the centroid for the next image in the loop:
|
-- load and display images in a loop |
|
-- create a CLabels object |
|
-- create a CCentroid object |
|
-- starting position for centroid |
|
-- loop over all images |
|
-- change to the next image |
|
-- attach the current displayed image |
|
|
|
-- get the centroid position |
|
-- label text |
|
-- draw the label on this image |
|
|
|
|
|
-- delete the object |
|
-- delete the object |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.