Skip to main content

Interactive N-dimensional numpy array viewer with FFT support

Project description

ndslice

Quick interactive visualization for N-dimensional NumPy arrays

A python package for browsing slices, applying FFTs, and inspecting data.

Quickly checking multi-dimensional data usually means writing the same matplotlib boilerplate over and over. This tool lets you just call ndslice(data) and interactively explore what you've got.

Usage

from ndslice import ndslice
import numpy as np

# Create some data
x = np.linspace(-5, 5, 100)
y = np.linspace(-5, 5, 100)
z = np.linspace(-5, 5, 50)
X, Y, Z = np.meshgrid(x, y, z, indexing='ij')

mag = np.exp(-(X**2 + Y**2 + Z**2) / 10)
pha = np.pi/4 * (X + Y + Z)
complex_data = mag * np.exp(1j * pha)

ndslice(complex_data, title='3D Complex Gaussian')

Showcase

Features

Data slicing and dimension selection should be intuitive: click the two dimensions you want to show and slice using the spinboxes.

Centered FFT - Click dimension labels to apply centered 1D FFT transforms. Useful for checking k-space data in MRI reconstructions or analyzing frequency content. FFT

Line plot - See 1D slices through your data. Shift+scroll for Y zoom, Ctrl+scroll for X zoom:

Line plot

Scaling

Log scaling is often good for k-space visualization. Symmetric log scaling is an extension of the log scale which supports negative values.

Colormap Change colormap:

  • Ctrl+1 Grayscale
  • Ctrl+2 Viridis
  • Ctrl+3 Plasma
  • Ctrl+4 Rainbow

Installation

From PyPI

pip install ndslice

From source

git clone https://github.com/henricryden/ndslice.git
cd ndslice
pip install -e .

Requirements

  • Python >= 3.8
  • NumPy >= 1.20.0
  • PyQtGraph >= 0.12.0
  • PyQt5 >= 5.15.0

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Built with PyQtGraph for high-performance visualization.


Henric Rydén

Karolinska University Hospital

Stockholm, Sweden

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

ndslice-0.1.3.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ndslice-0.1.3-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file ndslice-0.1.3.tar.gz.

File metadata

  • Download URL: ndslice-0.1.3.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for ndslice-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4a375b8e7f81bea0b993e354f20085661153fd5f3f92807d0d3473fd190f7a28
MD5 45764a06282e2e4b5e0d22c7a47e0780
BLAKE2b-256 a918788d92fd3416aaf6974554d1f2785287e6591dd0712cb575d7c1e54ef876

See more details on using hashes here.

File details

Details for the file ndslice-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: ndslice-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for ndslice-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7dbc86bf71f4cfdc7093ebe9b8a3c1edee5d0b25e473255c5901e7592d23a6bd
MD5 b1c3e5c4ceb975a44dee3c93361826a4
BLAKE2b-256 50523516a8d47961afda23a3e46c556648a72c9a6a9104a8ae3cef83d64b8825

See more details on using hashes here.

Supported by

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