
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
ndslice
Advanced tools
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.
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')

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.

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

Video export Right-clicking a dimension button to export a video or PNG frames along that dimension. The video export functionality is optional, and can be installed with
pip install ndslice[video_export]

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:
Axis flipping Click arrow icons (⬇️/⬆️ and ⬅️/➡️) next to dimension labels to flip axes. Default orientation is image-style (origin lower-left). Flip the primary axis for matrix-style (origin upper-left).
Non-blocking windows
By default, windows open in separate processes, allowing multiple simultaneous views:
ndslice(data1)
ndslice(data2) # Both windows appear
Use block=True to wait for the window to close before continuing:
ndslice(data1, block=True) # Script pauses here
ndslice(data2) # Shown after first closes
ndslice data.npy # Numpy file
ndslice --help # Show all options
File support ndslice has CLI support and can conveniently display:
| Format | File suffix | Requirement |
|---|---|---|
| NumPy | .npy, .npz | NumPy |
| MATLAB | .mat | scipy |
| HDF5 | .h5, .hdf5 | h5py |
| BART | .cfl + .hdr | — |
| Philips REC | .REC + .xml | — |
| NIfTI | .nii, .nii.gz | nibabel |
| DICOM (pixel array) | .dcm | pydicom |
HDF5 files can be compound complex dtype, or real/imag fields.
If there are multiple datasets in the file, a selection GUI appears which highlights arrays supported by ndslice (essentially numeric). Double click to open.

pip install ndslice
pip install ndslice[video_export] # Include video export dependencies (imageio, Pillow, imageio-ffmpeg)
pip install ndslice[all] # includes all optional dependencies (video export and file formats)
git clone https://github.com/henricryden/ndslice.git
cd ndslice
# Use directly without installing
python -m ndslice data.npy
pip install -e .
MIT License - see LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with PyQtGraph for high-performance visualization.
Henric Rydén
Karolinska University Hospital
Stockholm, Sweden
FAQs
Interactive N-dimensional numpy array viewer with FFT support
We found that ndslice demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.