Scripting Resources for DigitalMicrograph™ |
Image Montaging |
|
Function |
Creates an aligned montage from previously acquired images or raw (unaligned) montages. |
Version |
version:20210303, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
- |
Comments |
Ostensibly designed to be used with the companion script SEM Stage Scanning. That script will create a raw (unaligned) montage and can be used to save individual images from the montage. The Image Montaging script will align raw montages, or can recreate the raw montage from the individual images, and then align it. It can also be used to create a montage from any appropriate images captured on SEMs, Optical Microscopes, Cameras etc. The only requirements are that the image formats can be opened in DigitalMicrograph (eg TIFF, BMP etc), the files are appropriately numbered (see below), and the user knows the number of frames in x and y and the approximate percentage overlap. Once the images have been loaded into a raw (unaligned) montage, the user can then manually reposition them (if gross misalignments are present) and then automatically align them. Individual images saved from the SEM Stage Scanning script will be appropriately labelled, being numbered 0 (top left) to n (bottom right) with images numbers incrementing in a left to right, top to bottom raster. Images created on other platforms will need to be suitably numbered to ensure that they are loaded into the raw montage in the correct sequence. Once a raw montage image has been created, all individual images float and can be manually repositioned appropriately by clicking and dragging. Automatic alignment is done using cross-correlation. Where the cross-correlation coefficient drops below a user-defined threshold, an option to manually align the images will be presented. Various image processing filters can be applied to enhance the alignment process. Raw and aligned montages are image documents containing n+1 images. An option to excise the maximal area or the minimum area which excludes black space is given, the resulting image being a single (flat) image. Detailed descriptions of the various controls and the typical workflow can be found at the start of the script. Key strokes for manual alignment are displayed in the Output window.
|
System Requirements |
Tested on GMS 2.32, but should be compatible with all recent versions of DigitalMicrograph. Montaged image sets from any imaging source can be opened, assembled into a raw image and then aligned, provided the image format can be opened by DigitalMicrograph. |
Known Issues |
This script uses the ScrapCopy() and ScrapPaste() functions. I have found there to be a bug in the offline version of DM I use (GMS 2.32). After several uses of the script it throws errors about a thread not being able to access the clipboard - or access refused and the scrappaste() command stops working. This is not a script error, and it does not occur in my online versions of DM. If you do encounter the issue, simply restart DigitalMicrograph and the error will go away- for a while at least.
|
Supported |
Yes. |
Included Files |
Main script. |
Source Code |
see attached script |