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

 

Copy All Tags Between Images
Function
Copies all the tag information from one image to another. Useful for copying calibrations, microscope info etc from a captured image (which has the tag info by default) to a calculated image which does not.
Version
version:20021101, v1.0
Author
D. R. G. Mitchell
Acknowledgements
Comments
Originally designed for use with the Cumulus image archival system, which uses the microscope info tags to catalogue images. These are missing on ratio maps, EFTEMs and other images created by mathematical manipulation of images captured in DM (which do have the tag info).
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
Supported
Yes
Included Files
Main script file.
Source Code

// Script to copy ALL the tags from one image to another.

// This script would be used for copying tags from an image

// acquired in th usual manner, to one which was synthesised by

// processing - for example a diffraction pattern bolted together from two halves.

// Such processed images do no have any microscope info attached to them, and this is used for Cumulus

// archival - so it is important

 

// D. Mitchell Nov 2002

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

// Version 1.0

 

// version:20021101

 

image imgsource, imgtarget

 

try

gettwoimageswithprompt("0 = Source Image, 1 = Target Image","Copy ALL tags between images", imgsource, imgtarget)

 

catch

exit(0)

 

string targetname, sourcename

targetname=getname(imgtarget)

sourcename=getname(imgsource)

 

TagGroup sourcetags=imagegettaggroup(imgsource)

TagGroup targettags=imagegettaggroup(imgtarget)

taggroupcopytagsfrom(targettags,sourcetags)

 

showimage(imgsource)

showimage(imgtarget)

okdialog("All tags copied from '"+sourcename+"' to '"+targetname+"'.")