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

 

Stack Alignment
Function
Creates, splits, sums and aligns 3D stacks, such as a spectrum images.
Version
version:20250325, v2.1
Author
D. R. G. Mitchell.
Acknowledgements
-
Comments

This script has been completely revamped. It now contains new functionality to create stacks from individual images, and to split stacks into their component images. Stacks can be summed and can also be played in a Movie. Background threading has been added to make this readily controllable from the dialog interface.

Automatic alignment is unchanged, but manual alignment has also been converted into a background thread. This allows alignment to be done intuitively via buttons in the dialog and avoids the use of arcane key strokes. Four methods of manual alignment are provided and the stack can be stepped through quickly to locate any poorly aligned layers.

System Requirements
This script uses the IUImageFindMax() function. Gatan revised this function in GMS 3.6 and this script stopped working. I have now created two versions: one for GMS 3.5.1 and older and one for GMS 3.6.1 and newer. Download the zip folder and use the script which is suitable for your GMS. If you run it and it throws an error saying . . unkown function and highlighting a line of script . . .IUImageFindMax( . . . ), then you selected the incorrect version. More details on the recent changes to the IUImageFindMax() function can be found here.
Known Issues
Big stacks use up a lot of memory. Avoid using the Copy function if you have very large stacks, and only have one stack open at a time. The Auto function works very well where images are the same or very similar throughout the stack or change slowly. However, in EFTEM spectrum images, the abrupt contrast reversals may cause some issues. Try running the Auto routine first and then refine the aligned stack with the manual process. I have not tested this on Gatan tomography stacks. It should work and all calibrations and tags are copied to the aligned stack.
Supported
Yes
Included Files
Zip archive containing two scripts - choose the one appropriate for your GMS.
Source Code

See the downloaded file.