Scripting Resources for DigitalMicrograph™ |
Example: Adding Annotations to an image in an ImageDocument. |
|
Function |
Shows how to add annotations (lines, arrows and text) to three images in the same ImageDocument. |
Version |
version:20080518, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
- |
Comments |
ImageDocuments are the bounding containers for images, and can contain more than one image. Copy and paste images into another image, and you create a multi-image imagedocument. |
System Requirements |
Should be compatible with all recent versions of DigitalMicrograph. |
Known Issues |
This script expects to find an imagedocument with at least three images in it, and the images must be >200 x 200 pixels in size. |
Supported |
Yes |
Included Files |
Main script file. |
Source Code |
// Script to select images within an image document. // The script assumes there are at least three images present in the // foremost image document and that the images are >200 pixels in the // x and y dimensions. // Generate a test image by copying and pasting two images into a third image, then run this script. // D. R. G. Mitchell, adminnopsam@dmscripting.com (remove the nospam to make this email address work) // version:20080518, v1.0
// Select the foremost image document
imagedocument imgdoc=getfrontimagedocument()
// Select the first image and add a line annotation
image temp:=imgdoc.imagedocumentgetimage(0) temp.createlineannotation(50,50,200,200)
// Select the second image and add an arrow annotation
temp:=imgdoc.imagedocumentgetimage(1) temp.createarrowannotation(50,50,200,200)
// Select the third image and add a text annotation
temp:=imgdoc.imagedocumentgetimage(2) temp.createtextannotation(50,50,"Text")
|