Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio | Private | Search


Example: Access Image Calibration Information
An example script which shows how to access the calibration information in a lineplot/image/data cube.
D. R. G. Mitchell
Have an image foremost when running this script.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
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


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)