跳转到主要内容

未提供项目描述

项目描述

napari-broadcastable-points

License PyPI Python Version

可以在任意维度上广播的点层。在此作为在napari核心中实现更完整功能之前的解决方案(https://github.com/napari/napari/issues/2343)。

警告! 由于在napari问题中讨论的所有原因,这可能会非常脆弱,因此虽然它很有用,但也应谨慎使用。因此,在创建后不要过多地修改查看器的维度,因为不知道会发生什么。

安装

pip install napari-broadcastable-points

用法

这里有一个例子,我们有一个(TPCZYX)图像序列,我们在C轴和Z轴上广播点。

import napari
from napari_broadcastable_points import BroadcastablePoints
import numpy as np

v = napari.Viewer()

# create a fake timelapse
T = 5
P = 4
C = 3
Z = 2
Y, X = 512, 512
images = np.zeros([T, P, C, Z, Y, X])
v.add_image(images)

# Add the relevant components of points data
# fmt: off
dat = np.array([
       # T,  P,       Y,              X
       [ 0,  0., 340.25071184, 284.13186557],
       [ 0,  0., 312.66551847, 309.95630191],
       [ 0,  0., 240.76794003, 266.81775485],
       [ 0,  0., 240.47448053, 239.81948049],
       [ 0,  1., 261.60356481, 260.36164576],
       [ 0,  1., 309.43746393, 215.16888217],
       [ 0,  1., 371.06395974, 235.12412843]])
# fmt: on

v.dims.axis_labels = ('T', 'P', 'C', 'Z', 'Y', 'X')

points = BroadcastablePoints(dat, broadcast_dims = (2, 3))
v.add_layer(points)
napari.run()

example usage

创建一个空层

您还可以创建一个空层,但请务必指定ndim,否则您可能会遇到错误。

points = BroadcastablePoints(None, broadcast_dims = (2, 3), ndim=6)

由以下组织支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面