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

 

CSV Importer
Function
Imports x-ray, phase and PCA maps and linescans from Noran System Seven and colours them. Some other map file formats are also supported.
Version
version:20170913, v1.2
Author
D. R. G. Mitchell
Acknowledgements

Functions to look up chemical element information are courtesy of Werner Grogger. Pavel Potapov's method of relaunching a dialog from within itself is used here to update buttons.

Comments

Exporting x-ray and other maps in NSS and many other types of EDS software results in greyscale images. This script is designed to enable them to be imported into DigitalMicrograph and converted into coloured images - either indexed colour or RGB. In the case of CSV files exported from NSS, the x-ray maps have chemical information in the title as filename_Ab Z where filename can be anything; _ is an underscore (not a space); Ab is the chemical element followed by a space and Z is K, L or M to signify the lines used for mapping. Here this information within the filename is used to identify the chemical element. On the basis of the colour selection made within the periodic table of this script, the map is then appropriately coloured. Colour settings can be saved and easily recalled. This enables specific colour sets to be used to ensure maps are consistently coloured.

Maps in a number of other formats (TIFF, dm3, dm4, mrc) can also be imported. If there is no chemical information at the end of the filename, as per the above convention, then the maps are coloured in the order in which they are imported. Maps 1, 2, 3 will be coloured according to the colours selected for H, He, Li etc.

This script has a number of interesting capabilities (from a scripting perspective). The bevel buttons used cannot be recoloured on the fly, so the technique of relaunching the dialog after each change is used. It is a bit slow, but it works. Also, an interactive sub-dialog is used to call up the colour picker tool.

The script has a built in Help button to provide some information on using the script.

Updated in v1.2 to fix up style errors which left the element names as black blocks.

System Requirements
Should be compatible with GMS 1 and 2.
Known Issues
Users with maps which have a chemical element naming convention different to that used here, may need to relabel their maps. If the format is from a major vendor - Bruker, JEOL etc, please contact the author and he'll attempt to add an intuitive import function to this script.
Supported
Yes
Included Files
Main script file.
Source Code

See attached script.