Metadata-Version: 2.4
Name: arrayview
Version: 0.10.1
Summary: Fast multi-dimensional array viewer
Project-URL: Home, https://github.com/oscarvanderheide/arrayview
Project-URL: Source, https://github.com/oscarvanderheide/arrayview
Author-email: Oscar <oscarvanderheide@example.com>
License: MIT
License-File: LICENSE
Keywords: array,mri,npy,viewer,visualization
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Requires-Dist: fastapi>=0.129.0
Requires-Dist: h5py>=3.0
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: nibabel>=5.3.3
Requires-Dist: numpy>=2.4.2
Requires-Dist: pillow>=12.1.1
Requires-Dist: pyqt5>=5.15; sys_platform == 'linux'
Requires-Dist: pyqtwebengine>=5.15; sys_platform == 'linux'
Requires-Dist: python-multipart>=0.0.22
Requires-Dist: pywebview>=6.1
Requires-Dist: qmricolors>=0.1.2
Requires-Dist: qtpy>=2.0; sys_platform == 'linux'
Requires-Dist: scipy>=1.10
Requires-Dist: tifffile>=2023.1.1
Requires-Dist: uvicorn>=0.41.0
Requires-Dist: websockets>=14.0
Requires-Dist: zarr>=2.17
Description-Content-Type: text/markdown

# arrayview

A viewer for multi-dimensional arrays.

- CLI and Python
- Jupyter / VS Code
- Browser / native
- SSH / tunnels

## CLI

```bash
uvx arrayview scan.nii.gz
uvx arrayview --window browser scan.npy
uvx arrayview                            # demo
```

## Python

```python
from arrayview import view
view(arr)
```

## MATLAB

Add the `matlab/` directory to your MATLAB path, then:

```matlab
addpath('/path/to/arrayview/matlab')

A = rand(100, 200, 10);
arrayview(A)
```

Requires arrayview installed in [MATLAB's Python environment](https://www.mathworks.com/help/matlab/matlab_external/install-supported-python-implementation.html):

```bash
pip install arrayview
```

Arrays are passed zero-copy via the buffer protocol (in-process Python). `arrayview()` enables this automatically — just call it before any other `py.*` call in your MATLAB session.

## PyTorch / Deep Learning

```python
from arrayview import view_batch, TrainingMonitor

# Browse a DataLoader batch
view_batch(train_loader)
view_batch(train_loader, overlay='label')

# Live training monitor — updates every N epochs
monitor = TrainingMonitor(every=5, samples=3)
for epoch in range(100):
    for batch in val_loader:
        pred = model(batch['image'])
        monitor.step(input=batch['image'], target=batch['label'],
                     prediction=pred, epoch=epoch)
```

`view_batch()` accepts DataLoaders, Datasets, dicts, tuples, or raw tensors. `TrainingMonitor` opens a compare window and calls `handle.update()` automatically. PyTorch is not required at import time.


## Formats

`.npy` `.npz` `.nii` `.nii.gz` `.zarr` `.pt` `.h5` `.tif` `.mat`

## Once open

**Navigation:** scroll slices · `h`/`l` cycle dims · `j`/`k` slices · `=`/`-` zoom · drag pan
**Views:** `v` 3-plane · `z` mosaic · `q` qMRI · `n` compare · `=` immersive
**Display:** `c`/`C` colormaps · `d`/`D` dynamic range · `f` FFT · `m` complex · `p` projections · `L` log
**Tools:** `S` segmentation · `u` ruler · `s` screenshot · `?` help


## nnInteractive Segmentation

`S` starts AI-assisted 3D segmentation (requires CUDA). Click/draw to segment, `Enter` to accept.

```toml
[nninteractive]
url = "http://gpu-server:1527"   # skip auto-launch, use running server
```

Or: `ARRAYVIEW_NNINTERACTIVE_URL=http://gpu-server:1527`


## Config

`~/.arrayview/config.toml`:

```toml
[viewer]
colormaps = ["gray", "viridis", "plasma"]   # colormaps cycled by 'c'

[window]
default = "browser"                         # browser | native | vscode | inline
```

[Full documentation →](https://oscarvanderheide.github.io/arrayview/)
