top bar

Using the Micro-Manager python library

Revision as of 11:55, 12 October 2009 by Arthuredelstein (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

(The python wrapper for Micro-Manager will be released soon...)

The python wrapper does not include the Java GUI -- only the C++ core can be controlled. After Micro-Manager has been installed on your machine, MMCorePy.py will be located in the main Micro-Manager directory; it requires many library files in that directory (with suffixes like .dll, .so, .pyd) to operate. To use the MMCorePy library, you will need to install the latest versions of:

You can make the Micro-Manager python wrapper library generally available by adding your micro-manager directory to the PYTHONPATH environment variable.

Images returned by calls to the Micro-Manager core object (CMMCore) are stored in numpy arrays for convenience, and can be easily displayed by pylab (matplotlib) commands. Here is a short example that demonstrates use of the python wrapper to acquire and display an image.

# Create a Micro-Manager core object:
import MMCorePy
mmc = MMCorePy.CMMCore()

#  Load and initialize the demo camera device:
mmc.loadDevice("cam","DemoCamera","DCam")
mmc.initializeDevice("cam")

# Snap and retrieve an image:
mmc.snapImage()
im1 = mmc.getImage()

# Display the image:
from pylab import *
ion() # Activate interactive mode
figure()
imshow(im1,cmap = cm.gray)

A longer example script, MMCoreWrapDemo.py, is available in the Micro-Manager root directory.

© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact