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

 

Example: Calculate Histogram
Function
A short script which shows how to calculate a histogram from the frontmost image using the ImageCalculateHistogram() function.
Version
version:20040702, v1.1
Author
D. R. G. Mitchell
Acknowledgements
Comments
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 calculate the histogram

// of the foremost image

 

// v1.1

// version:20040702

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

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

 

image front:=getfrontimage()

string imgname=getname(front)

number min,max

minmax(front, min, max)

imagedisplay imgdisp=imagegetimagedisplay(front,0)

image hist=integerimage("",2,1,max-min,1)

ImageCalculateHistogram( front, hist, 0, min, max)

imagesetdimensionorigin(hist,0,min)

showimage(hist)

setname(hist, "Histogram of "+imgname)