simple nd image viewer
Project description
ndv
Simple, fast-loading, asynchronous, n-dimensional array viewer for Qt, with minimal dependencies.
import ndv
data = ndv.data.cells3d()
# or ndv.data.nd_sine_wave()
# or *any* arraylike object (see support below)
ndv.imshow(data)
As an alternative to ndv.imshow()
, you can instantiate the ndv.NDViewer
(QWidget
subclass) directly
from qtpy.QtWidgets import QApplication
from ndv import NDViewer
app = QApplication([])
viewer = NDViewer(data)
viewer.show()
app.exec()
ndv.NDViewer
- very fast import and load time
- supports arbitrary number of dimensions, with 2D/3D view canvas, and sliders for all non-visible dims
- sliders support integer as well as slice (range)-based slicing
- colormaps provided by cmap
- supports vispy and pygfx backends
- supports any numpy-like duck arrays, including (but not limited to):
numpy.ndarray
cupy.ndarray
dask.array.Array
jax.Array
pyopencl.array.Array
sparse.COO
tensorstore.TensorStore
(supports named dimensions)torch.Tensor
(supports named dimensions)xarray.DataArray
(supports named dimensions)zarr
(supports named dimensions)
See examples for each of these array types in examples
[!NOTE] You can add support for any custom storage class by subclassing
ndv.DataWrapper
and implementing a couple methods.
(This doesn't require modifying ndv, but contributions of new wrappers are welcome!)
Installation
The only required dependencies are numpy
and superqt[cmap,iconify]
.
You will also need a Qt backend (PyQt or PySide) and one of either
vispy or pygfx,
which can be installed through extras ndv[<pyqt|pyside>,<vispy|pygfx>]
:
pip install ndv[pyqt,vispy]
[!TIP] If you have both vispy and pygfx installed,
ndv
will default to using vispy, but you can override this with the environment variableNDV_CANVAS_BACKEND=pygfx
orNDV_CANVAS_BACKEND=vispy
Motivation
This package arose from the need for a way to quickly view multi-dimensional arrays with zero tolerance for long import times and/or excessive dependency lists. I want something that I can use to view any of the many multi-dimensional array types, out of the box, with no assumptions about dimensionality. I want it to work reasonably well with remote, asynchronously loaded data. I also want it to take advantage of things like named dimensions and categorical coordinate values when available. For now, it's a Qt-only widget, since that's where the need arose, but I can imagine a jupyter widget in the future (likely as a remote frame buffer for vispy/pygfx).
I do not intend for this to grow into full-fledged application, or wrap a complete scene graph, though point and ROI selection would be welcome additions.
Project details
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 ndv-0.0.4.tar.gz
.
File metadata
- Download URL: ndv-0.0.4.tar.gz
- Upload date:
- Size: 34.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef5ba6ca3aaec0cbc8dbfef160045ab9f10505307dec6f3da76637b053f9f535 |
|
MD5 | d7a5ba86ba74bcee3c93bf5b9415842f |
|
BLAKE2b-256 | 27a1b3bc45071fed07a937e8b08bc845f88bd68086a817aa9b1fe0adbab2adad |
File details
Details for the file ndv-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: ndv-0.0.4-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92923ec3853860eb9369511dce88baf9009c60465093579c3f50901d43d086ec |
|
MD5 | 30dfcf053ddf640739ed36c7794ec722 |
|
BLAKE2b-256 | 2a159215ee0483e728abd1726cff52887d0b7a35bc70653a8445a49fd83f208d |