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

 

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:20180329, v2.0
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

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.

Updated in v2.0 - added the ability to use the acquisition date stamp and time stamp information as names. These stamps are added to the image by DigitalMicrograph at the time they are acquired. Also added is the ability to save images in .dm3 format (only available in GMS 2 and 3).

 

System Requirements
Tested on GMS 2.3 but should work on GMS 3.0. This script will not work on GMS 1.x as is - but can be easily configured to work by editing a single line in the script before using or installing. Details of which line to edit are given at the start of the script - just open the script in DigitalMicrograph and make the edit indicated. Note, GMS 1.x will save in .dm3 format only. GMS 2 and 3 save in .dm4 format by default and only those versions can make use of the option in this updated script to save as .dm3 option.
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.

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.

Note that this updated script will not run in GMS 1.x - without editing a single line in the script - see System Requirements above.

Supported
Yes
Included Files
Source code
Source Code

See attached script