No project description provided
Project description
napari-broadcastable-points
Points layer that can broadcast over arbitrary dimensions. Available here as a workaround until something more complete is implemented in napari core (https://github.com/napari/napari/issues/2343).
Warning! This is likely to be very brittle for all the reasons discussed in the napari issue - so while it is useful it should also be used with caution. So don't muck around much with the viewer dims after creating, because who knows what will happen.
Installation
pip install napari-broadcastable-points
Usage
Here is an example where we have an image sequence of (TPCZYX) and we broadcast points over the C
and Z
axes.
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()
Creating an empty layer
You can also create an empty layer - but be sure to specify ndim
otherwise you may run into an error.
points = BroadcastablePoints(None, broadcast_dims = (2, 3), ndim=6)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file napari_broadcastable_points-0.5.0.tar.gz
.
File metadata
- Download URL: napari_broadcastable_points-0.5.0.tar.gz
- Upload date:
- Size: 75.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6af5e3570dc5604962bf4a73336bb69761fc4a6ba19a634e5b01460999dd795f |
|
MD5 | 0ae57cb707a077b2c8fe8c4ca6282f16 |
|
BLAKE2b-256 | 58b05ca247df07888aee486eb9f1d8ed09890769a95ec7c21d30d6a443cc2eca |
File details
Details for the file napari_broadcastable_points-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: napari_broadcastable_points-0.5.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7385230821cc30d8cc4cd964cede5946470812d757324fdeb46d5bdf4e11bc00 |
|
MD5 | a91dad7f5c55433273db11cb1c8001d2 |
|
BLAKE2b-256 | 0645db4c9837fc6c2ab15bc6d23d1fa07cb01c7667681b7b7758ccff060a26e0 |