Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

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

 

Create Spectrum from Image
Function
Converts a CCD image of an EELS spectrum into a conventional EELS spectrum.
Version
version:20040208, v1.0
Author
D. R. G. Mitchell
Acknowledgements
Comments
Will carry out a vertical sum on any image, not just an image of an EELS spectrum.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
Supported
Yes
Included Files
Main script file.
Source Code

// Script to convert a CCD image of an EELS spectrum

// into a standard EELS spectrum. All tags associated with the

// CCD image are copied to the final EELS spectrum.

 

// version:20040208

 

// This functionality exists within the 'Filter' menu of a fully configured EELS system

// but is not found in offline systems.

 

// version 1.0

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

// D. R. G. Mitchell, February 2004

 

// Variables

 

number width, height, maxval

number scalex, scaley, originx, originy

string name

 

// Acquire the foremost image and salient information

 

image front:=getfrontimage()

getname(front, name)

getsize(front, width, height)

 

getscale(front, scalex, scaley)

getorigin(front, originx, originy)

maxval=max(front)

 

// Create a spectrum from the image

 

image projection = realimage(name+" sp", 4, width, 1)

projection = 0

projection[icol,0]+=front

setname(projection, name+" sp")

 

// Copy all the tags from the foremost image to the spectrum

 

TagGroup sourcetags=imagegettaggroup(front)

TagGroup targettags=imagegettaggroup(projection)

taggroupcopytagsfrom(targettags,sourcetags)

 

// Display and position the spectrum

 

showimage(projection)

setwindowposition(projection, 142,24)

setwindowsize(projection, 880, 455)

updateimage(projection)

 

// Calibrate and annotate the spectrum

 

ImageSetDimensionCalibration( projection, 0, originx, scalex, "eV", 1 )

ImageSetIntensityUnitInfo( projection, "e-", 1 )

 

imagedisplay spectrumdisp=imagegetimagedisplay(projection,0)

LinePlotImageDisplaySetDoAutoSurvey(spectrumdisp, 0, 1 )

LinePlotImageDisplaySetContrastLimits(spectrumdisp, 0, (maxval+(maxval/15)) )