Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

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


Batch Import Noran CSV Files
A batch importation utility to read in text files saved in CSV format (comma separated values), from Noran System 7 EDS software.
version:20150311, v1.1
D. R. G. Mitchell
Thanks to Tom Sha and Vincent Hou for assistance with the fast ImageImportTextData() function.

In Noran System 7 a suite of x-ray maps can be selected (yellow outline) and then exported in CSV format. This is a text format with a short header followed by the data. This script will read all the salient information from the header and import the file with the correct spatial and intensity calibrations. Navigate to the folder containing the CSV maps and select one of the maps. The script will then import all such maps in that location, ignoring any files which do not have a .csv or .txt extension. Sub-folders are also ignored. Ensure that any greyscale images (exported as CSV) are not included, otherwise as error will occur.

Updated in v1.1 to continue importing even if no calibration scale is found. There is a problem with ultra-high magnification images (eg 40mx) whereby the scale value (in ums by default) is so small at this magnfication that the value gets rounded to zero and the import would fail. This script will now run, but such images will be uncalibrated. They can be easily recalibrated in DM following importation.

System Requirements
Should be compatible with all recent versions of DigitalMicrograph including GMS 2. Tested with NSS 7 but should be compatible with CSV files from earlier versions - assuming the header format has not changed.
Known Issues
To avoid potential clashes with non-csv files, export your map data sets from NSS into a separate folder and then import them into DigitalMicrograph from there. Do not include other types of csv images or non-csv text files - otherwise the conversion will fail. Images are read in and converted in alphabetical order. The selected image simply points to the folder and may not necessarily get converted first. Images are converted into real greyscales. If required, they can be colourised by applying a colour lookup table using the Apply CLUT script. Such images remain greyscale and normal measurement and line profile evalutation etc will continue to work.
Included Files
Main script file.
Source Code

See attached script.