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

 

Example: Stop or Start a Camera View Image
Function

An example script which shows how to find a Camera View imageand either stop or start/restart it.

Version
version:20210621, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments

If you have a range of images open, the script will search through them to find the Camera View image (if present) and either stop or start/restart it. The Camera View image is the live camera image created through the Gatan 'Camera View' dialog. If you ask the script to restart a Camera View image, and no existing Camera View image is found, the option to start a new Camera View image will be given. The acquisition parameters used will be those specified in the Gatan Camera View dialog 'Search' values. The choice of which parameter set to use (Search, Focus etc) can be set in the script by specifying the appropriate parameter set name (string).

There exists a Camera Manager function 'Object CM_GetCurrentCameraViewer()' which returns an object - which I assume to be the camera viewer object. This might be potentially very useful. However, there are no commands (which I have found) which operate on this object. Potentially, this might yield useful info, such as a flag to indicate if the viewer is running and more efficient commands to stop/restart it. If anyone has any insights into to hidden commands which might make much of this clunky code redundant, please let me know.

This functionality was developed as a workaround to a problem with the Rio 16 Camera. Camera acquisition scripts on the Ultrascan camera can initiate an acquisition regardless of whether a live view (Camera View) image is running. The camera controller plays nice and stops the View image - completes the acquisition for the script - and then restarts the View image. However, on the Rio 16, an acquisition script will freeze if a Camera View image is running and produce a timeout error - while it waits for the Camera View image to stop. I presume this is a bug and not a feature. This script works around that by checking on the status of the Camera View image, and stopping it when instructed to do so.

System Requirements
Tested on GMS 2.32 with an Ultrascan 2k camera and on GMS 3.3 with a Rio 16 Camera. Should be compatible with all recent Gatan cameras.
Known Issues

A function is used to find the Camera Viewer image. If found the function returns 1 and the image variable is returned by reference. If not found, the function returns 0. The function looks for specific acquisition tags which identify the Camera View image. However, as these may change with time or GMS version, this may not be a long-term solution.

Supported
Yes
Included Files
Main script file.
Source Code

See attached script