npy2bdv
A library for writing/reading HDF5/XML datasets of Fiji BigDataViewer/BigStitcher format as numpy arrays.
Installation
Run pip install npy2bdv in the command line. Use import npy2bdv in the code.
From source (development)
With mamba (or conda):
git clone https://github.com/nvladimus/npy2bdv.git
cd npy2bdv
mamba env create -f environment.yml
mamba activate npy2bdv
Or with pip only: pip install -e .[dev].
Run the tests from the repo root: python -m pytest test.
Releasing
Bump version in pyproject.toml, then publish a GitHub release tagged v<version>.
The publish workflow runs the tests and uploads the package to PyPI.
The docs are rebuilt and deployed to GitHub Pages on every push to master
(docs workflow). To build them locally:
pip install -e .[docs], then sphinx-build -b html docs/source docs/build/html.
Documentation
https://nvladimus.github.io/npy2bdv/: a user guide with code examples, and a detailed API reference.
Larger, timed examples are in the Jupyter notebook.
Supported H5/XML writing options
- pixel types
uint16(default),uint8,float32:BdvWriter(..., dtype='float32'). Types other thanuint16need an up-to-date Fiji (BigDataViewer-core >= 10.4.6). - compression methods
None,gzip,lzf(Noneby default). - downsampling options:
- any number of mipmap levels
- computed via averaging, compatible with BigDataViewer/BigStitcher convention.
- user-defined block sizes for H5 storage (default
4,256,256) - any number of time points, illuminations, channels, tiles, angles.
- arbitrary affine transformation for each individual view (e.g. translation, rotation, shear).
- arbitrary voxel calibration for each view, to account for spatial anisotropy.
- individual views can differ in dimensions, voxel size, voxel units, exposure time, and exposure units.
- missing views are labeled in XML automatically.
- support of additional meta-information:
- camera properties:
name,exposureTime,exposureUnits microscope(name and version),user
- camera properties:
- writing virtual stacks of arbitrary size, by plane or sub-stack. Handy when your stack is larger than your RAM.
- virtual stacks can be written with multiple subsampling levels and compression.
New features
See Recent changes
Writing speed
Currently speeds between 150 - 320 MB/s were achieved with confidence. Speeds of up to 2300 MB/s reported in earlier versions are likely due to bugs in testing methods in notebook examples_h5writing.ipynb. More testing is underway.
Acknowledgements
This code was inspired by Talley Lambert's code and improved by generous input from Adam Glaser, VolkerH, Doug Shepherd, Peter H, Mike Taormina and Pradeep Rajasekhar.
To report issues or bugs please use the issues tool.
Citation
You can cite it like so
Support
If you find this library useful, send me some love 😊
It will give me some dopamine and motivation to keep improving it ❤️
Metadata
Release files for npy2bdv 1.1.0
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 | Actions |
|---|---|---|---|---|
| npy2bdv-1.1.0.tar.gz | 60.2 kB | With provenance | Details for npy2bdv-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| npy2bdv-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for npy2bdv-1.1.0-py3-none-any.whl |
Total release size: 100.9 kB
Release files / npy2bdv-1.1.0.tar.gz
| Download URL | npy2bdv-1.1.0.tar.gz |
|---|---|
| Size | 60.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7333b44c0ed360781639b090c6c039b56dbe9d6db4c33e8964c0a184839cda1
|
|
BLAKE2b-256 checksum How to use checksums |
44a08328ba1fe4295a3eb8dd1e8073a1d6bf786bf50209cf319076072b759fb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logRelease files / npy2bdv-1.1.0-py3-none-any.whl
| Download URL | npy2bdv-1.1.0-py3-none-any.whl |
|---|---|
| Size | 40.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d97275764758640b5b4d8426a83628a34ec079f41fc7a327e9b79ff1f1cffd3
|
|
BLAKE2b-256 checksum How to use checksums |
fc95cca264a85e21d10e0c6f52d0a93a6be478d1bfe0f24748249490da3c678d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logSecurity for npy2bdv 1.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for npy2bdv-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logA 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.