Getting Started
Installation
blockbuster can be installed from PyPI on all operating systems, for Python ≥ 3.9.
Virtual environment (recommended)
We recommend creating a dedicated environment:
or with pixi:The one function you need
tile_process(image, fn) splits image into tiles, runs fn on each tile,
and returns a globally consistent label array.
image— a dask array or a path to an OME-ZARR storefn— any callable(ndarray) -> ndarrayreturning integer labels
Step 1: write your function
blockbuster is method-agnostic. Your function receives a NumPy array (one tile) and must return an integer label array of the same shape:
import numpy as np
def my_fn(tile: np.ndarray) -> np.ndarray:
from skimage.filters import threshold_otsu
from skimage.measure import label
binary = tile > threshold_otsu(tile)
return label(binary).astype("int32")
The function is called independently on every tile. blockbuster ensures that objects spanning tile boundaries are merged into a single label.
Step 2: run it
Set the tile size
Add overlap
Methods like Cellpose and StarDist need spatial context at tile boundaries.
Use overlap (in voxels) so boundary objects are fully visible:
result = tile_process(
"image.zarr", my_fn,
tile_shape=(1, 2048, 2048),
overlap=20, # 20-voxel halo on every side
)
How overlap works
Each tile is expanded by overlap voxels on every side before calling fn.
The halo is trimmed before merging — the final output has the original shape.
Objects near boundaries have enough context to be segmented correctly.
Use Cellpose
from blockbuster import tile_process
from blockbuster.plugins.cellpose import cellpose_fn
fn = cellpose_fn("cyto3", gpu=True, diameter=30)
tile_process(
"image.zarr", fn,
channel=0,
tile_shape=(1, 2048, 2048),
overlap=20,
write_to="labels.zarr",
progress=True,
)
See the Cellpose 2-D example for the full workflow.
What's next?
- Tiling strategy — how tiles are sized and overlapped
- Merging labels — how cross-boundary labels become one
- Skip empty tiles — speed up sparse volumes
- GPU & distributed — Dask clusters for GPU workloads
- Common pitfalls — GIL traps, recompute traps, memory traps