forked from micro-manager/pycro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi_thread_core.py
32 lines (25 loc) · 925 Bytes
/
multi_thread_core.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events, start_headless, ZMQRemoteMMCoreJ
import threading
def snap_image():
while True:
core = ZMQRemoteMMCoreJ()
try:
core.snap_image()
image = core.get_tagged_image()
except Exception as e:
print("snap image error: %s" % e)
import traceback
traceback.print_exception(e)
if __name__ == '__main__':
# mm_app_path = '/Applications/Micro-Manager-2.0.0-gamma1'
# config_file = '/Applications/Micro-Manager-2.0.0-gamma1/MMConfig_demo.cfg'
#
# start_headless(mm_app_path, config_file, timeout=10000)
# bridge = Bridge(timeout=1000)
core = ZMQRemoteMMCoreJ()
print(core.get_version_info())
t = threading.Thread(target=snap_image, args=())
t.start()
while True:
tm = core.get_exposure()
print("Exposure %d" % tm)