Skip to main content

simple nd image viewer

Project description

ndv

License PyPI Python Version CI codecov

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)

Montage

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 variable NDV_CANVAS_BACKEND=pygfx or NDV_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

ndv-0.0.3.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

ndv-0.0.3-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

Details for the file ndv-0.0.3.tar.gz.

File metadata

  • Download URL: ndv-0.0.3.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for ndv-0.0.3.tar.gz
Algorithm Hash digest
SHA256 82a3b64c69ea78d914b3feece95ce68efbe86ca4c7d3de1c027f538d0b56a075
MD5 b9c964cdd3c295d38adec164870ebc85
BLAKE2b-256 b9e9f5a9003d251b890db4ecae912658d3e2d114fe80fe4f2a35cdff38744f11

See more details on using hashes here.

File details

Details for the file ndv-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ndv-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for ndv-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 899fcbf0900036b2f5c3b713f71893522104a8e8b2e6bf71f5827d568db885f8
MD5 7dadb81c58c85a8e7420da4c27381443
BLAKE2b-256 81330bf74c46b61750328bfa4a530e8f4fcb672072b062d4768a07fa806b849b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page