-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
52 lines (38 loc) · 1.3 KB
/
main.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
48
49
50
51
52
import napari
from napari_animation import Animation
def main() -> None:
# toggle multiscale to tradeoff between speed and resolution
MULTISCALE = False
viewer = napari.Viewer()
viewer.open(
"http://public.czbiohub.org/royerlab/zebrahub/imaging/multi-view/ZMNS001.ome.zarr",
plugin="napari-ome-zarr",
rendering="attenuated_mip",
gamma=0.7,
)
# disabling multiscale
if not MULTISCALE:
for channel in ("mezzo", "h2afva"):
viewer.layers[channel].multiscale = False
viewer.layers[channel].data = viewer.layers[channel].data[0]
# aesthetics changes
viewer.layers["h2afva"].colormap = "cyan"
viewer.layers["h2afva"].contrast_limits = (50, 850)
viewer.layers["mezzo"].colormap = "magenta"
viewer.layers["mezzo"].contrast_limits = (50, 500)
# making it 3D
viewer.dims.ndisplay = 3
# setting t = 0
viewer.dims.set_point(0, 0)
# starting recording
animation = Animation(viewer)
animation.capture_keyframe()
# setting t = 220
viewer.dims.set_point(0, 220)
# updating contrasts
viewer.layers["h2afva"].contrast_limits = (50, 2500)
# ending recording
animation.capture_keyframe(600)
animation.animate('video.mp4', fps=60)
if __name__ == "__main__":
main()