Scripting Resources for DigitalMicrograph™ |
Example: Access Image Calibration Information |
|
Function |
An example script which shows how to access the calibration information in a lineplot/image/data cube. |
Version |
|
Author |
D. R. G. Mitchell |
Acknowledgements |
|
Comments |
Have an image foremost when running this script. |
System Requirements |
Should be compatible with all recent versions of DigitalMicrograph. |
Known Issues |
|
Supported |
Yes |
Included Files |
Main script file. |
Source Code |
// Example script to show how to access the calibration information from the foremost image (or lineplot) // This is the information contained in the calibration window obtained when right clicking on an image
image front:=getfrontimage() // get the foremost image
// a simple way to directly access the unit string in the foremost image
string unitstring=imagegetdimensionunitstring(front,0) okdialog("The unit string is = "+unitstring)
// an alternative way to access the unit string plus all the other calibration information
number dimension, origin, scale, calibformat calibformat=1 dimension=0 //(note a lineplot has only one dimension, an image 2, a data cube 3)
ImagegetDimensionCalibration( front, dimension, origin, scale,unitstring,calibformat ) okdialog("Unit String = "+unitstring+"\nDimension = "+dimension+"\nOrigin = "+origin+"\nScale = "+scale) |