Napari Data Inspection
A napari plugin for fast, high-throughput inspection of 2D/3D segmentation datasets. Select one or more images and/or labels layers; files are paired and loaded automatically so you can browse entire datasets without manual effort.
Features
- Multi-folder pairing: any number of image/label folders
- Prefetching & caching for steamless navigation
- Supports common formats (e.g., NIfTI, TIFF, PNG, NRRD, MHA, B2ND) out of the box.
- Extensible loaders (add your own formats if needed).
Installation
# a) Install the plugin
pip install napari-data-inspection
# b) Install the plugin and napari if necessary
pip install napari-data-inspection[all]
Quickstart
napari -w napari-data-inspection
Data organization
- Filter files by patterns (e.g., *_img.nii.gz, *_seg.nii.gz) and/or separate folders per layer.
- Number of files must match across layers; pairs are made by sorted order.
1. Separate folders per layer
Put each layer’s files in its own directory.
/data/images/
case001.nii.gz
case002.nii.gz
/data/labels/
case001.nii.gz
case002.nii.gz
2. By Patterns
Use patterns (globs) per layer.
/data/
case001_img.nii.gz
case001_seg.nii.gz
case002_img.nii.gz
case002_seg.nii.gz
Patterns
Images: *_img.nii.gz
Labels: *_seg.nii.gz
Supported file types
The data loading is based on the ViData package. The following Extensions and Backends are available.
| Extension(s) | Backend(s) | Notes |
|---|---|---|
.png, .jpg, .jpeg, .bmp |
imageio |
Standard 2D image formats |
.tif, .tiff |
tifffile |
Multipage TIFF; high bit-depths supported |
.nii.gz, .nii, .mha, .nrrd |
sitk |
Medical image formats (3D volumes) |
.nii.gz, .nii |
nibabel |
Alternative medical imaging backend |
.b2nd |
blosc2 |
Compressed N-dimensional arrays |
.b2nd |
blosc2pkl |
Compressed N-dimensional arrays with metadata in a separate .pkl |
.npy |
numpy |
Single NumPy array |
Custom Load Functions
- Register a reader with a decorator.
- Reader must return (numpy_array, metadata_dict).
- Registration happens at import time—make sure this module is imported (e.g., from your package’s init.py).
- See here for an example.
- metadata should contain an "affine" if entry, if any spatial transformation should be applied
# custom_io_template.py — fill in the TODOs and import this module somewhere at startup.
import numpy as np
from typing import Tuple, Dict, List
# TODO: import your backend library (e.g., imageio, tifffile, nibabel, SimpleITK, ...)
# import imageio.v3 as iio
from vidata.registry import register_loader, register_writer
# --------------------------- READER ------------------------------------------
# Replace file extension and backend name to your custom function
@register_loader("image", ".png", ".jpg", ".jpeg", ".bmp", backend="imageio") # To Register Image Loading
@register_loader("mask", ".png", ".bmp", backend="imageio") # To Register Label Loading
def load_custom(file: str) -> tuple[np.ndarray, dict]:
"""
Load a file and return (data, metadata).
metadata can be empty or include keys like: spacing, origin, direction, shear, dtype, etc.
"""
# data = iio.imread(file) # example for imageio
data = ... # TODO: replace
meta = {} # TODO: replace
return data, meta
Torch Dataset Inspection
- Rapid inspection of PyTorch datasets in Napari by browsing images and corresponding labels directly from any torch.utils.data.Dataset
from napari_data_inspection.dataset_inspection import DatasetInspectionWidget, run_dataset_inspection
from torch.utils.data import Dataset
# Example: inspect a PyTorch dataset
dataset = MyCustomDataset(...) # any torch Dataset
run_dataset_inspection(dataset, channel_first=True, rescale=True, no_label=False, bg_class=0)
Acknowledgments
This repository is developed and maintained by the Applied Computer Vision Lab (ACVL) of Helmholtz Imaging and the Division of Medical Image Computing at DKFZ.
This napari plugin was generated with copier using the napari-plugin-template.
Metadata
Release files for napari-data-inspection 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| napari_data_inspection-1.0.3.tar.gz | 25.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| napari_data_inspection-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.2 kB
Release files / napari_data_inspection-1.0.3.tar.gz
| Download URL | napari_data_inspection-1.0.3.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54c846791ab78008342d802c2722153a2ca5fb6b32c774c56ac97ecf05c74fd5
|
|
BLAKE2b-256 checksum How to use checksums |
38985859de4246cdb35d0fecd22058dea330c31f2e70e1400adb4853c94065ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / napari_data_inspection-1.0.3-py3-none-any.whl
| Download URL | napari_data_inspection-1.0.3-py3-none-any.whl |
|---|---|
| Size | 25.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b404ad6f6d59778dbbe51ffcccfd46c149a3855d5966ecb6912be915478ec120
|
|
BLAKE2b-256 checksum How to use checksums |
ef03c8ae65bb8a785321743548222f5b040df03229f4290ab0ec41a37afcecea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for napari-data-inspection 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.