Project

General

Profile

RE: Leginon with Gatan K2 » comexample.py

python script to test comtypes communication to example plugin - Jim Pulokas, 10/26/2012 10:51 AM

 

import comtypes.client

def connect():
mod = comtypes.client.GetModule('COMExamplePlugIn.dll')
cam = comtypes.client.CreateObject('COMExamplePlugIn.COMExampleInterface.1', interface=mod.ICOMExampleInterface)
return cam

def acquire(cam):
processing = 1 # unprocessed
exposure = 0.5
bin_x = 1
bin_y = 1
ccd_area_t = 0
ccd_area_l = 0
ccd_area_b = 512
ccd_area_r = 512
image = cam.AcquireFromCamera_NewImage(processing, exposure, bin_x, bin_y, ccd_area_t, ccd_area_t, ccd_area_b, ccd_area_r)
return image

def test():
cam = connect()
im = acquire(cam)
nrows = len(im)
ncols = len(im[0])
print 'acquired image size %dx%d' % (ncols,nrows)

if __name__ == '__main__':
test()
raw_input('press enter to quit.')
(3-3/3)