Metadata-Version: 2.1
Name: tunnelvision
Version: 0.3.3
Summary: Experimental tensor viewer for IPython built on top of Voxel
Home-page: https://github.com/sluijs/tunnelvision
Author: Rogier van der Sluijs
License: GNU
Project-URL: Documentation, https://tunnelvision.readthedocs.io/
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dataclasses (>=0.6)
Requires-Dist: numpy
Requires-Dist: packaging
Requires-Dist: PyYAML (>=5.4.1)
Requires-Dist: tabulate
Requires-Dist: termcolor
Requires-Dist: websockets
Requires-Dist: shortuuid
Provides-Extra: dev
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: flake8-bugbear ; extra == 'dev'
Requires-Dist: flake8-comprehensions ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: black (==22.8.0) ; extra == 'dev'
Requires-Dist: click (==8.0.2) ; extra == 'dev'
Requires-Dist: pytest-cov (>=2.10.1) ; extra == 'dev'
Requires-Dist: pre-commit (>=2.9.3) ; extra == 'dev'
Requires-Dist: parameterized ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mistune (<2.0.0,>=0.8.1) ; extra == 'docs'
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: sphinxcontrib.bibtex ; extra == 'docs'
Requires-Dist: m2r2 ; extra == 'docs'

# Tunnelvision

Tunnelvision is an experimental tensor viewer for IPython environments based on Voxel.

## Installation
Tunnelvision requires Python 3.7+. Wheels are _only_ available for MacOS (x86_64) and Linux for now.

To install Tunnelvision, run:

```bash
pip install tunnelvision
```

## Quick Start
The API of tunnelvision is very similar to that of [matplotlib](https://github.com/matplotlib/matplotlib). Tunnelvision is a 5D tensor viewer that requires tensors to have the following format: _Batch_ x _Depth_ x _Height_ x _Width_ x _Channels_, where channels can be 1 (grayscale/monochrome) or 3 (RGB). You can quickly plot (medical) images using:

```python
import numpy as np
import tunnelvision as tv

arr = np.random.randint(0, 2048, (2, 3, 224, 224, 1), dtype=np.uint16)
tv.show(arr)
```

More advanced plots with segmentation overlays (or colormaps in general) can be created as follows:
```python
ax = tv.Axes(figsize=(512, 512))
ax.imshow(arr1)
ax.imshow(arr2, cmap="seg")
ax.show()
```

[Pyvoxel](https://github.com/pyvoxel/pyvoxel) has support for tunnelvision as well, which allows you to plot images with their correct orientation and spacing, without having to manually set those in the configuration:

```python
import voxel as vx

mv = vx.load("../data/ct/")
tv.show(mv)
```

## VS Code Remote
To use tunnelvision through VS Code remote, we need forward an arbitrary available port to the tunnelvision-server. Once you have forwarded a port from the `ports` pane within VS Code, make sure to add it to your configuration file for tunnelvision:

```yaml
# ~/.cache/tunnelvision/default_config.yaml
port: 1337
```


