Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

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

 

Example: Lineplot Cursor Position and Show
Function
Demonstrates how to position the cursor (vertical black line) in a lineplot. Lineplots include EELS spectra, intensity plots etc.
Version
version:20050713, v1.0
Author
D. R. G. Mitchell
Acknowledgements
Thanks to Douglas Hague for tips on using the commands herein.
Comments
A lineplot image, such as an EELS spectrum, must be front-most to use this script.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
A number of lineplotimagedisplay . . . commands were undocumented, including the cursor-related ones. This may have changed in the latest online help.
Supported
Yes
Included Files
Main script file.
Source Code

// An example script which shows how to position and show/hide the cursor

// (the vertical black line) in a lineplot.

 

// D. R. G. Mitchell, July 2005

// version:20050713, v1.0

// adminnospam@dmscripting.com (remove the nospam to make this email address work)

 

// Thanks to D. Hague (Gatan) for assistance with slice commands.

 

number x,y,bool,xsize, ysize

image front:=getfrontimage()

lineplotimagedisplay lindsp=front.imagegetimagedisplay(0)

object sliceid=lindsp.ImageDisplayGetSliceIDByIndex(0)

 

// lineplots with multiple traces eg EELS overlays contain slices numbered 0,1,2,3 etc

// this selects the foremost one.

 

lindsp.lineplotimagedisplaygetcursorstate(sliceid,x,bool)

 

// x is the cursor position, bool is shown or hidden

okdialog(" X pos = "+x+" Cursor is Shown = "+bool)

 

getsize(front, xsize, ysize)

 

if(bool==1)

{

okdialog("I'm turning the cursor off now")

lindsp.lineplotimagedisplaysetcursorstate(sliceid,x,0)

}

 

 

while (3>2)

{

x=x+10

if(x>xsize-1) x=5

if(twobuttondialog("Let's shuffle the cursor along","Cancel","Shuffle")) exit(0)

lindsp.lineplotimagedisplaysetcursorstate(sliceid,x,1)

}