forked from micro-manager/pycro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xy_tiling.py
47 lines (37 loc) · 1.34 KB
/
xy_tiling.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from pycromanager import XYTiledAcquisition, multi_d_acquisition_events
def event_edit_fn(event):
# row = event["row"]
# col = event["col"]
# TODO: if you want to cancel, dont return anything
return event
def image_callback_fn(image, metadata):
row = metadata["Axes"]["row"]
col = metadata["Axes"]["column"]
channel = metadata["Axes"]["channel"]
# other image axes (e.g. a z axis). 'position' axis is redundant to row and column indices
axes = metadata["Axes"]
# numpy array
image
# TODO: run callback function
return image, metadata
with XYTiledAcquisition(
directory=r"/Users/henrypinkard/tmp/",
name="tiled",
tile_overlap=10,
image_process_fn=image_callback_fn,
pre_hardware_hook_fn=event_edit_fn,
debug=False,
) as acq:
# 10 pixel overlap between adjacent tiles
acq.acquire({'axes': {
"row": 0, "column": -1, "channel": 'green'
},
"config_group": ("Channel", "FITC")})
acq.acquire({'axes': {
"row": 0, "column": 0, "channel": 'green'
},
"config_group": ("Channel", "FITC")})
acq.acquire({'axes': {
"row": 0, "column": 1, "channel": 'green'
},
"config_group": ("Channel", "FITC")})