ndslice


Namendslice JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryInteractive N-dimensional numpy array viewer with FFT support
upload_time2025-10-29 17:24:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords visualization numpy fft image-viewer data-visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```python
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](docs/images/showcase.gif)

## 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](docs/images/fft.gif)

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

![Line plot](docs/images/lineplot.png)

**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


**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:
```python
ndslice(data1)
ndslice(data2) # Both windows appear
```

Use `block=True` to wait for the window to close before continuing:
```python
ndslice(data1, block=True)  # Script pauses here
ndslice(data2)  # Shown after first closes
```


### Command Line
```bash
ndslice data.npy # Numpy file
ndslice --help   # Show all options
```

**File support**
ndslice has CLI support and can conveniently display:

- Numpy `.npy` / `.npz`
- MATLAB `.mat` (requires scipy)
- HDF5 `.h5` / `.hdf5`, (requires h5py)
- [BART](https://mrirecon.github.io/bart/) `.cfl` + `.hdr`
- Philips `.REC` + `.xml`
- NifTI `.nii` / `.nii.gz`
- Dicom pixel array `.dcm` (requires 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.

![Selector](docs/images/selector.png)


## Installation

### From PyPI

```bash
pip install ndslice
pip install h5py # Optional for HDF5 CLI support
```

### From source

```bash
git clone https://github.com/henricryden/ndslice.git
cd ndslice

# Use directly without installing
python -m ndslice data.npy

pip install -e .
```


## Requirements

- Python >= 3.8
- NumPy >= 1.20.0
- PyQtGraph >= 0.12.0
- PyQt5 >= 5.15.0
- h5py >= 3.0.0 (for HDF5 file support in CLI)

## License

MIT License - see LICENSE file for details.

## Contributing

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

## Acknowledgments

Built with [PyQtGraph](https://www.pyqtgraph.org/) for high-performance visualization.


---
Henric Rydén

Karolinska University Hospital

Stockholm, Sweden

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ndslice",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "visualization, numpy, fft, image-viewer, data-visualization",
    "author": null,
    "author_email": "Henric Ryd\u00e9n <henric.ryden@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/80/82/4e8cdbef8578d6f61bd5f057856e48fbb771b3ebd14aadcf873ca28d9f25/ndslice-0.3.1.tar.gz",
    "platform": null,
    "description": "# ndslice\n\n**Quick interactive visualization for N-dimensional NumPy arrays**\n\nA python package for browsing slices, applying FFTs, and inspecting data.\n\nQuickly 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.\n\n## Usage\n```python\nfrom ndslice import ndslice\nimport numpy as np\n\n# Create some data\nx = np.linspace(-5, 5, 100)\ny = np.linspace(-5, 5, 100)\nz = np.linspace(-5, 5, 50)\nX, Y, Z = np.meshgrid(x, y, z, indexing='ij')\nmag = np.exp(-(X**2 + Y**2 + Z**2) / 10)\npha = np.pi/4 * (X + Y + Z)\ncomplex_data = mag * np.exp(1j * pha)\n\nndslice(complex_data, title='3D Complex Gaussian')\n```\n\n![Showcase](docs/images/showcase.gif)\n\n## Features\n\nData slicing and dimension selection should be intuitive: click the two dimensions you want to show and slice using the spinboxes.\n\n**Centered FFT** - Click dimension labels to apply centered 1D FFT transforms. Useful for checking k-space data in MRI reconstructions or analyzing frequency content.\n![FFT](docs/images/fft.gif)\n\n**Line plot** - See 1D slices through your data. Shift+scroll for Y zoom, Ctrl+scroll for X zoom:\n\n![Line plot](docs/images/lineplot.png)\n\n**Scaling**\n\nLog scaling is often good for k-space visualization.\nSymmetric log scaling is an extension of the log scale which supports negative values.\n\n\n**Colormap**\nChange colormap:\n- `Ctrl+1` Grayscale\n- `Ctrl+2` Viridis\n- `Ctrl+3` Plasma\n- `Ctrl+4` Rainbow\n\n\n**Axis flipping**\nClick arrow icons (\u2b07\ufe0f/\u2b06\ufe0f and \u2b05\ufe0f/\u27a1\ufe0f) next to dimension labels to flip axes.\nDefault orientation is image-style (origin lower-left).\nFlip the primary axis for matrix-style (origin upper-left).\n\n**Non-blocking windows**\n\nBy default, windows open in separate processes, allowing multiple simultaneous views:\n```python\nndslice(data1)\nndslice(data2) # Both windows appear\n```\n\nUse `block=True` to wait for the window to close before continuing:\n```python\nndslice(data1, block=True)  # Script pauses here\nndslice(data2)  # Shown after first closes\n```\n\n\n### Command Line\n```bash\nndslice data.npy # Numpy file\nndslice --help   # Show all options\n```\n\n**File support**\nndslice has CLI support and can conveniently display:\n\n- Numpy `.npy` / `.npz`\n- MATLAB `.mat` (requires scipy)\n- HDF5 `.h5` / `.hdf5`, (requires h5py)\n- [BART](https://mrirecon.github.io/bart/) `.cfl` + `.hdr`\n- Philips `.REC` + `.xml`\n- NifTI `.nii` / `.nii.gz`\n- Dicom pixel array `.dcm` (requires pydicom)\n\nHDF5 files can be compound complex dtype, or real/imag fields.\n\nIf there are multiple datasets in the file, a selection GUI appears which highlights arrays supported by ndslice (essentially numeric).\nDouble click to open.\n\n![Selector](docs/images/selector.png)\n\n\n## Installation\n\n### From PyPI\n\n```bash\npip install ndslice\npip install h5py # Optional for HDF5 CLI support\n```\n\n### From source\n\n```bash\ngit clone https://github.com/henricryden/ndslice.git\ncd ndslice\n\n# Use directly without installing\npython -m ndslice data.npy\n\npip install -e .\n```\n\n\n## Requirements\n\n- Python >= 3.8\n- NumPy >= 1.20.0\n- PyQtGraph >= 0.12.0\n- PyQt5 >= 5.15.0\n- h5py >= 3.0.0 (for HDF5 file support in CLI)\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Acknowledgments\n\nBuilt with [PyQtGraph](https://www.pyqtgraph.org/) for high-performance visualization.\n\n\n---\nHenric Ryd\u00e9n\n\nKarolinska University Hospital\n\nStockholm, Sweden\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Interactive N-dimensional numpy array viewer with FFT support",
    "version": "0.3.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/henricryden/ndslice/issues",
        "Documentation": "https://github.com/henricryden/ndslice#readme",
        "Homepage": "https://github.com/henricryden/ndslice",
        "Repository": "https://github.com/henricryden/ndslice"
    },
    "split_keywords": [
        "visualization",
        " numpy",
        " fft",
        " image-viewer",
        " data-visualization"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8ccd069d5efa118d387c1e9df82d8cac27debb04d9e972652e5875aef0e7e778",
                "md5": "3e426e899a7d32ba5d00bee583be9185",
                "sha256": "14185d35fac8ceaaf1e942cbcf52c678db13a764961b3ec834bd7935b64a0dd1"
            },
            "downloads": -1,
            "filename": "ndslice-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e426e899a7d32ba5d00bee583be9185",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 28355,
            "upload_time": "2025-10-29T17:24:16",
            "upload_time_iso_8601": "2025-10-29T17:24:16.371827Z",
            "url": "https://files.pythonhosted.org/packages/8c/cd/069d5efa118d387c1e9df82d8cac27debb04d9e972652e5875aef0e7e778/ndslice-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "80824e8cdbef8578d6f61bd5f057856e48fbb771b3ebd14aadcf873ca28d9f25",
                "md5": "206a3cbd41ebde6c6fb98984173c9137",
                "sha256": "f78207af1420398d07a24e0a2e93f7fecca79bd1045dc81f93d6e6ecde041782"
            },
            "downloads": -1,
            "filename": "ndslice-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "206a3cbd41ebde6c6fb98984173c9137",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 28646,
            "upload_time": "2025-10-29T17:24:17",
            "upload_time_iso_8601": "2025-10-29T17:24:17.235305Z",
            "url": "https://files.pythonhosted.org/packages/80/82/4e8cdbef8578d6f61bd5f057856e48fbb771b3ebd14aadcf873ca28d9f25/ndslice-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-29 17:24:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "henricryden",
    "github_project": "ndslice",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ndslice"
}
        
Elapsed time: 0.65505s