Scripting Resources for DigitalMicrograph™


Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio | Private | Search


Equalise the intensity difference across two halves of an image caused by CCD readout calibration errors.
version:20161018, v1.0
D. R. G. Mitchell

Modern, large CCD cameras have two sets of readout electronics to get information out of the camera faster. If the gain calibration across these two readouts is not perfect, then the left half of the image may appear slightly brighter or darker than the right half. This imbalance can be corrected by running the relevant calibration routine. However, in very short exposure/noisy images the imbalance may still be present. To correct the imbalance, run this script and use the up/down arrow keys to modify the intensity of the right hand side of the image until it matches the left. Once you are satisfied with the result, hit any other key to terminate the adjustment. The adjustment is done on a clone of the original image, which is unchanged by this script.

This script attaches a key listener to the image to listen for key strokes. This is computationally much more efficient than using a While() loop with the getkey() function. The key listener method runs in background and does nothing until a key stroke is registered. In contrast the while() loop/getkey() method will chew up lots of CPU cycles as it runs in the foreground.

System Requirements

Tested on GMS 2.32 running under Windows 7, but should be compatible with all recent versions of DM/Windows.

Known Issues

The script adjusts the relative intensity of the right hand side of the image by 0.25% per arrow key click. Adjust this value in the script (see the start) if you want larger or smaller adjustments per click. The region of the right hand half is taken as half the camera x dimension. If you use binning or other settings which results an odd size in x, you may find that a single column of pixels adjacent to the centre line does not get adjusted. If you run into this issue, please contact the author.

Included Files
Source Code

see attached script.