BDV-Playground Deconvolution
Tiled, lazy, multi-GPU Richardson–Lucy deconvolution for large 5D microscopy images (XYZ + channels + timepoints), in Python.
pip install bdv-playground-deconvolution # import bdvpg_deconvolution
It handles images far bigger than GPU memory by working tiled and lazily: each volume is split into overlapping blocks, each block is deconvolved on the GPU, and nothing is computed until you actually browse or export the result. Multiple GPUs (or several contexts on one GPU) can be used in parallel.
All channels and timepoints are processed and written out by default, in the original order, using a single PSF.
Under the hood it drives BigDataViewer-Playground and CLIJ2 through PyImageJ. Python is the orchestration layer.
Why deconvolution
The axial (Z) view is where widefield blur is worst and where deconvolution helps most:
| Raw | Deconvolved |
|---|---|
Install
pip install bdv-playground-deconvolution # core
pip install "bdv-playground-deconvolution[notebook]" # + JupyterLab
Works in any Python ≥3.10 environment — venv, conda, or uv pip. This puts
bdvpg-deconvolve and bdvpg-smoke-test on your PATH; call them directly, no
uv run prefix. (If you are working from a clone instead, see
Development.)
No conda required, and you do not need to install Java or Maven yourself.
scyjava/jgo provision both automatically via
cjdk on first use, into a user-level cache
(%LOCALAPPDATA%\cjdk on Windows, ~/.cache/cjdk elsewhere).
The only real prerequisite is an OpenCL-capable GPU with vendor drivers installed — that part is not pip-installable.
First run is heavy. Installing is a few MB, but the first run downloads a JDK (~190 MB), Maven, and the ImageJ2/BIOP Maven tree — several hundred MB, once, then cached. It needs
maven.scijava.orgreachable.
Verify your setup without a GPU or any data:
bdvpg-smoke-test # boots the JVM, resolves every Java class used
Quick start (CLI)
Headless and save-only — the intended batch / pipeline interface:
bdvpg-deconvolve \
--image /path/to/image.czi \
--psf /path/to/psf.tif \
--out /path/to/output_folder \
--iterations 120 \
--threads 10
Writes <image>.ome.tiff to the output folder, preserving channel order.
bdvpg-deconvolve --help lists every option.
Notebook
The notebook is not shipped in the wheel — grab it from the repo:
curl -LO https://raw.githubusercontent.com/unige-biochem/bdv-playground-deconvolution/main/notebooks/Deconvolve.ipynb
jupyter lab
notebooks/Deconvolve.ipynb does interactive
parameter tuning and views raw + deconvolved side by side in BigDataViewer.
Use mode="interactive" (needs a display).
Library
from bdvpg_deconvolution import DeconvolveParams, init_imagej, run
ij = init_imagej(mode="headless", max_heap="32g")
run(DeconvolveParams(
image_file="image.czi",
psf_file="psf.tif",
output_folder="out/",
num_iterations=120,
), ij=ij)
A JVM starts once per process, so init_imagej() must be called before any
work and its mode cannot change afterwards.
Point Spread Function
One single-channel PSF is supplied per image and reused for all channels. If no empirical PSF (e.g. from sub-resolution beads) is available, a theoretical one can be generated with the PSF Generator Fiji plugin.
Parameters
| Flag | Default | Notes |
|---|---|---|
--iterations |
120 | Richardson–Lucy steps |
--regularization |
0.0 | 0 = none; increase to tame noise/ringing |
--no-non-circulant |
(on) | disable non-circulant edge handling |
--block-size-x/y/z |
256/256/64 | tiling — lower if you run out of GPU memory |
--overlap-size |
16 | tile overlap, avoids seams |
--threads |
10 | CPU-side workers feeding the GPU pool |
--output-pixel-type |
keep original | or Float |
--compression |
LZW | OME-TIFF compression |
--resolution-levels |
1 | OME-TIFF pyramid levels |
--unit |
MICROMETER | coordinate unit |
--overwrite |
off | refuse to clobber existing output unless set |
--mode |
headless | escape hatch if a command misbehaves headless |
--max-heap |
— | JVM heap, e.g. 32g |
The CLI is save-only by design — it deconvolves and writes an OME-TIFF. Viewing results is the notebook's job: a CLI process exits as soon as the work is done, which tears down the JVM and any BigDataViewer window with it.
Multi-GPU configuration
By default deconvolution runs on a single GPU (device 0). The device pool is
configured through ImageJ preferences — a Pool Configuration string of the
form device_idx:n_workers, device_idx:n_workers. For example 0:2, 1:4 runs
2 contexts on GPU 0 and 4 on GPU 1, i.e. 6 GPU workers. It persists in the
ImageJ preferences and applies to subsequent runs.
Pool workers vs
--threads. The pool config sets the number of GPU-side workers.--threadsis the number of CPU-side workers feeding that pool (load, convert, hand to GPU, retrieve, write). Keep--threadsa bit higher than the total GPU workers so the GPUs are never left waiting.
Nextflow
The CLI is the intended Nextflow interface — one image per task, headless:
process deconvolve {
input:
tuple val(sample), path(image), path(psf)
output:
path "${image.baseName}.ome.tiff"
script:
"""
bdvpg-deconvolve --image ${image} --psf ${psf} --out . \\
--iterations ${params.iterations} --threads ${params.threads}
"""
}
One JVM boots per invocation, so one-image-per-task is the right granularity.
For reproducible runs, containerise with the OpenCL runtime, a pre-warmed cjdk
cache, and a pre-resolved .jgo env so tasks don't each re-download.
Reproducibility
Two package managers are in play. uv.lock pins the Python side; the Java side
is pinned by the coordinates in
bdvpg_deconvolution/pipeline.py:
DEFAULT_ENDPOINTS = [
"net.imagej:imagej:2.16.0",
"ch.epfl.biop:bigdataviewer-biop-tools:0.21.0",
]
Bump those and cut a release when you want to move the Java side.
The JVM itself is not pinned by default — cjdk prefers a suitable system JDK
and downloads one otherwise. To pin it, before the first init_imagej():
from scyjava import config
config.set_java_constraints(fetch="always", vendor="zulu", version="21")
Status
The pipeline is a faithful transcription of a production Fiji/Groovy workflow,
and the interop layer is verified (bdvpg-smoke-test passes: JVM boots, all Java
classes and the SourceService resolve). A full GPU run has not been
exercised end-to-end here — validate against a known dataset first.
Not yet implemented:
--check-gpu— enumerate OpenCL devices and fail early with a readable message instead of a CLIJ stack trace mid-run.--prefetch— warm the JDK/Maven/jgo caches ahead of first use.
Development
From a clone, uv manages the environment and uv.lock pins it:
git clone https://github.com/unige-biochem/bdv-playground-deconvolution
cd bdv-playground-deconvolution
uv sync # core
uv sync --extra notebook # + JupyterLab
uv run bdvpg-smoke-test # verify the Java interop
uv runuses the project's own.venvand ignores an activated conda environment. Either useuv runfrom the clone, orpip installinto your conda env and call the commands directly — don't mix the two.
Credits
Built on the BigDataViewer-Playground / Kheops / CLIJ2 stack.
License
MIT — see LICENSE. © Nicolas Chiaruttini, Department of
Biochemistry, University of Geneva.
That covers this package's own source, which is pure Python orchestration and
ships no Java code. The Java stack it drives is resolved from Maven on your
machine at first run, and parts of it are GPL — notably Bio-Formats
formats-gpl, which supplies the readers for proprietary formats such as
.czi. Simply installing and running this package does not put you under those
terms; the GPL restricts copying, distribution and modification, not use.
If you redistribute a bundle that contains those jars — most likely the container image suggested in Nextflow — you are distributing a combined work, and the bundle as a whole must go out under GPL terms. The sources here remain MIT for anyone who takes them on their own.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bdv_playground_deconvolution-0.21.0.1.tar.gz.
File metadata
- Download URL: bdv_playground_deconvolution-0.21.0.1.tar.gz
- Upload date:
- Size: 203.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36677d016b153dbb8eae9901f13e2f2c848bfb331806c4ab4e0d94f4766a3882
|
|
| MD5 |
ebb25d6b9d4f848ae726942539d338dd
|
|
| BLAKE2b-256 |
3d3dd0f14026929f707add8b64f27fde427891e68ff33078a994ca2f57371f0f
|
Provenance
The following attestation bundles were made for bdv_playground_deconvolution-0.21.0.1.tar.gz:
Publisher:
release.yml on unige-biochem/bdv-playground-deconvolution
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bdv_playground_deconvolution-0.21.0.1.tar.gz -
Subject digest:
36677d016b153dbb8eae9901f13e2f2c848bfb331806c4ab4e0d94f4766a3882 - Sigstore transparency entry: 2211084262
- Sigstore integration time:
-
Permalink:
unige-biochem/bdv-playground-deconvolution@d97cb41ac67fe7df09964708987fcda65010c252 -
Branch / Tag:
refs/tags/v0.21.0.1 - Owner: https://github.com/unige-biochem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d97cb41ac67fe7df09964708987fcda65010c252 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bdv_playground_deconvolution-0.21.0.1-py3-none-any.whl.
File metadata
- Download URL: bdv_playground_deconvolution-0.21.0.1-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89aa6f3d6e68c5bf9753a4f746c423dc0c7c85a5f7c261e55f2e08f54901fba9
|
|
| MD5 |
5d9716b1035d3a65642864153351d19c
|
|
| BLAKE2b-256 |
ce9f408611cbf3482e04c124f4e589093547d286426fd2115069b33dc0f4eca2
|
Provenance
The following attestation bundles were made for bdv_playground_deconvolution-0.21.0.1-py3-none-any.whl:
Publisher:
release.yml on unige-biochem/bdv-playground-deconvolution
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bdv_playground_deconvolution-0.21.0.1-py3-none-any.whl -
Subject digest:
89aa6f3d6e68c5bf9753a4f746c423dc0c7c85a5f7c261e55f2e08f54901fba9 - Sigstore transparency entry: 2211084284
- Sigstore integration time:
-
Permalink:
unige-biochem/bdv-playground-deconvolution@d97cb41ac67fe7df09964708987fcda65010c252 -
Branch / Tag:
refs/tags/v0.21.0.1 - Owner: https://github.com/unige-biochem
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d97cb41ac67fe7df09964708987fcda65010c252 -
Trigger Event:
release
-
Statement type: