CLabels:Preferences
The Preferences method creates a text label on an image. This method opens a dialog like that shown below. See the Mira User's Guide for more information about labeling images.
|
|
bSuccess = CLabels:Preferences() where |
The [OK] and [Apply] buttons apply changes to the current script only.
The [Save] button sets the attributes as the default for future scripts or Mira use.
bSuccess is the returned success code. If you click [Cancel] or the attached CImageView is nilthen false is returned.
This method sets preferences for all labels drawn after the dialog is closed. If this method is not used, the labels use default settings. This dialog might be opened immediately after construction of the CLabels object to set preferences for all labels. The effect of changes is to alter the label attributes for all images in the CImageView. This happens even if you call the Preferences method in the middle of a loop for an intermediate image in the image set. After the script finishes, you can also update the label attributes by clicking on the Label toolbar on the image window.
The following script tracks a centroid position through the image set and draws a label at the centroid coordinate on each image. The preferences method is used to set different label attributes before a label is added to each image:
|
-- open and display images in a CImageView |
|
-- create a CLabels object |
|
-- set label preferences, or exit the script |
|
-- 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 |