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

 

File Name Creator
Function
Creates file names for images and spectra using user-defined terms and microscope information to expedite the saving of data.
Version
version:20160206, v1.2
Author
D. R. G. Mitchell
Acknowledgements
Thanks to Scott Walck for suggesting the creation of this script and for assisting with the development and testing.
Comments

Note: If you downloaded the earlier version of this script, please uninstall it and use this version. I inadvertently posted a development version of the script, and consequently it contained numerous bugs and key functionality did not work.

When saving data at the microscope, considerable time is spent typing in file names. More information is usually better than less, but this takes up valuable instrument time. DigitalMicrograph has an automated file name creation tool, but this script greatly extends on that capability. Here the file name is built up using a series of parameters defined by the user. These include such things as a reverse date counter (my personal favourite) - YYMMDDXYZ, where XYZ increments by one after each save. COUNTER, TIME and DATE parameters are also available. Free text fields are available: NAME 1 and NAME 2 - typically data such as material type, specimen or experiment details are included here and will remain constant for a particular specimen. The NOTE field contains details which change with each image - such 'as detail of XYZ', 'SADP of ABC' etc. This note information is usually appended at the end of the file name but can be inserted anywhere. A range of microscope parameters can be sourced from the image - such as the imaging mode, the magnification/camera length. If the image is acquired in Scanning mode, then the signal source (HAADF, BF, BEI etc) can be obtained and if HAADF, the STEM camera length included. The latter only works on DigiScan-based systems. The user must define signal types based on their DigiScan system - read the start of the script for details. If the image is a spectrum and the Data Type (EDS or EELS) has been set, then this information can be accessed and included also.

The script uses a main dialog. This has a small footprint to conserve desktop space. It contains a Save button, the Note field - any text typed here will be automatically erased after each save. A '?' (help) button will display information (in the Results/Output window) about what the next file name will be, and where the save path is. It will also provide some hints and tips on using the script. The Tools button will display a sub-dialog from which the components used to make up the file name are selected. Components selected from top to bottom in the sub-dialog will appear in the filename from left to right. The Selection sub-dialog can be closed when selections have been made, and the smaller main Save dialog will remain available to use.

The typical workflow will be to define the naming sequence; acquire an image; edit the Note field (if used), then click on Save. An option to automatically close the image after saving is available. Please check that images are being saved correctly in the correct format when first using this script, so that in the event of any issues, you do not lose data. This script is provided in good faith . . not responsible for any losses . . etc. To edit any of the filename parameters, click on the Tools buttons, make your changes, close the Selection sub-dialog, and carry on.

When saving the first image, a prompt to set the save path is given. Thereafter, all images go to that path. To change the path, click on the Save button with ALT held down.

After each save, details on the saved image are listed in the Results/Output window. You can use this window as an electronic logbook by directly typing into this window any experimental details you wish to record against the filename just saved.. When you have finished, click on the Results/Output window and save it (File/Save As) with your images. DM saves the contents of this window in .s format (script format) which is plain text. Simply point any text editor at your .s file to read your experimental log.

If you have any other bits of information you want added to this script - please contact the author.

 

System Requirements
Tested on GMS 2.3 but should work with earlier versions.
Known Issues

This is designed to be used with an online version of DigitalMicrograph - ie one connected to a microscope. In the case of microscope information, data can only be sourced if it is present on the image within tags. If the tag information is missing then that piece of information will be missing from the filename. Note images acquired from a Gatan camera or DigiScan will contain the tags. However, if you acquire an image and then do some image processing on it, such rotation etc, the tags can get lost from the processed image. Make sure you save the original images before you do any processing.

Images are saved in the Gatan format relevant to your version of DM (.dm3 in GMS 1.x and .dm4 in GMS 2+).

If you want to report bugs with this script which relate to microscope information, it is essential that you send me the image which is causing you issues. Ideally, capture a small version of the image (eg 128 x 128) to reduce bandwidth.

Supported
Yes
Included Files
Source code
Source Code

See attached script