Metadata-Version: 2.4
Name: dataset-viewer
Version: 1.0.1
Summary: Allow to view a dataset image by image and edit their labels
Author-email: Hillpro <66534835+Hillpro@users.noreply.github.com>
License: The MIT License (MIT)
        
        Copyright (c) 2023-2026 Hillpro
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project-URL: Homepage, https://github.com/Hillpro/dataset-viewer
Project-URL: Bug Tracker, https://github.com/Hillpro/dataset-viewer/issues
Keywords: napari,dataset,segmentation,labels,viewer,annotation
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: napari
Requires-Dist: numpy
Requires-Dist: Pillow
Provides-Extra: gui
Requires-Dist: PyQt5; extra == "gui"
Dynamic: license-file

# Dataset Viewer

[![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/Hillpro/dataset-viewer/blob/main/LICENSE)
[![Supported Python versions](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FHillpro%2Fdataset-viewer%2Frefs%2Fheads%2Fmain%2Fpyproject.toml&query=%24%5Bproject%5D.requires-python&label=python&color=blue&link=https%3A%2F%2Fpypi.org%2Fproject%2Fdataset-viewer%2F
)](https://python.org)
[![Python package index](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FHillpro%2Fdataset-viewer%2Frefs%2Fheads%2Fmain%2Fpyproject.toml&query=%24%5Bproject%5D.version&label=pypi&color=orange&link=https%3A%2F%2Fpypi.org%2Fproject%2Fdataset-viewer%2F
)](https://pypi.org/project/dataset-viewer)
[![Python package index download statistics](https://img.shields.io/pypi/dm/dataset-viewer)](https://pypistats.org/packages/dataset-viewer)
[![Development Status](https://img.shields.io/badge/status-beta-yellow.svg)](https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta)

A small [napari](https://napari.org) wrapper that lets you step through a folder of images and paint / edit segmentation labels for each one. Labels are saved to disk as PNGs, one per image.

## Install

It is recommended to install the dataset viewer into a virtual environment. To install, run: 

```sh
python -m pip install "dataset_viewer[gui]"
```

The `[gui]` extra installs PyQt5 as the napari Qt backend. Omit it if you already have a Qt binding available in your environment.

> **Python version** — developed and tested on Python 3.9. `requires-python = ">=3.9"` allows newer interpreters, but no testing has been done on 3.10+; use at your own risk.

## Data layout

The viewer expects a directory with two sub-folders:

```
<data_path>/
├── images/     # .jpg, .jpeg or .png source images
└── labels/     # .png label masks, created/updated by the viewer
```

Labels are always written as PNG (other formats compress and corrupt label values) and named after the source image stem — e.g. `images/cat_01.jpg` → `labels/cat_01.png`. An image with an all-zero label array is represented by the **absence** of the label file; the viewer deletes the file when you clear a mask.

## Usage

```python
from pathlib import Path
from dataset_viewer import Viewer, Dataset

Viewer(Dataset(Path("path/to/data"))).start()
```

`Dataset()` with no argument falls back to `../../data` **relative to the current working directory**, so prefer passing an explicit path.

### Key bindings

| Key      | Action                               |
| -------- | ------------------------------------ |
| `Left`   | Previous image (saves current mask)  |
| `Right`  | Next image (saves current mask)      |
| `l`      | Print the active layer name          |
| `Escape` | Close the viewer                     |

Painting/erasing uses napari's standard labels-layer controls.

## License

MIT — see [LICENSE](LICENSE).
