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

 

Stage Through Focus Acquisition
Function
Acquires a 3D Stack of through-focus images on an SEM equipped with DigiScan, by stepping the stage.
Version
version:20200609, v1.0
Author
D. R. G. Mitchell
Acknowledgements
Thanks to Dr Mitchell Nancarrow for assistance with testing this script.
Comments

WARNING: This script has the potential to drive the SEM stage into the polepiece or a backscattered electron (BSE) detector. Read and understand the instructions and carry out controlled tests as per the instructions to validate its safe operation. Users of the script do so entirely at their own risk.

Originally, the aim was to adjust the objective lens instead of the stage. However, on the microscope which I was using (JEOL 6490 SEM), the objective lens could only be set to values predetermined by a lookup table of working distances - which made it non-viable. Stage z through-focus imaging works well at low magnifications (a few hundred times), where image movement is negligible. It may not work well at high magnifications, depending on the performance of your stage. It also will only work at zero tilt.

If you are running this script for the first time, you will need to set a safe minimum stage height. The script will prompt you for this value. Decide what value this is. If your typical specimen is say 5mm high and the absolute minimum seperation betweeen polepiece/BSE detector and the top of the specimen you are prepared to risk is 3mm, then the safe minimum height of the stage would be 8mm (5+3). You need to know what numerical values the microscope uses (calibrated or arbitrary) in order to set this safe position. So, manually set the stage to this minimum safe height (8mm in the example above - your height will be different), wthout a specimen present (ie the stage is the highest object). Then click on the 'Get' button for the Stage Z Bottom Focus. Read the value shown and note it down. On my 6490 SEM a stage height of 8mm would appear as 8000 (ie it reports in microns).

Rerun the script and when prompted to enter the minimum safe height enter 8000. Your microscope may NOT report in these units. The numerical value you use will vary depending on your microscope and if you have a retractable BSE detector. If your BSE is retractable, it is strongly recommended that you retract it when using this script, to avoid the risk of accidental damage.

At first use you need to test this script in a cautious way. Use a very long working distance so that the specimen is a long way from the polepiece (eg 20+ mmm). If your BSE detector is retractable, retract it to avoid the risk of accidental damage. Follow the operating instructions shown at the start of the script and ensure that the script is stepping through stage z by driving the specimen AWAY from the polepiece ie the stage z numerical value (the seperation between the stage and the polepiece) should increase with each step. The script is designed to only step the stage AWAY from the polepiece.If the opposite is happening, this is dangerous and you should stop using the script immediately.

This script will capture DigiScan signal 0 by default. Signals are numbered 0,1,2, 3 in the order in which they are listed in the DigiScan preferences (tools button in the lower right of the DigiScan control panel).
If you wish to use a signal other than zero, you can set it by: File/Global Info/Global Tags/Through Focus Acquisition/Default Values/DigiScan Signal (0-3). Note - this preference will only exist once the script has been run at least once. After launching the script set the image X Size and Y Size to specify the size of the image DigiScan will acquire. Specify the acquisition time for the frame. 5-10s is usually about right for a noise-free image. By default this script acquires 2byte images and it does not use Line Synching. If you need to change these options contact the author for advice.

The script produces a 3D stack where each slice of the stack is an image taken at a given stage height. You can scroll through the stack using the Slice control panel. You can mine this stack to extract a single 2D image of optimum focus, using the zFocus script.

This script will only operate on an SEM which has DigiScan attached.

System Requirements
Tested on GMS 2.x - but should be compatible with all versions of DigitalMicrograph.
Known Issues

This script has the potential to damage your microscope. Read the warnings and follow the instructions carefully. Only expert users should use this script, and then only with the permission of the microscope manager, who should validate it for your microscope. This script is provided in good faith, but no warranty as to its fitness for purpose is provided. Users of this script do so entirely at their own risk. The author accepts no responsibility for any damage or loss arising from its use.

Supported
Yes.
Included Files
Single script file.
Source Code

See attached script file.