Relabelling
blockbuster.relabel_sequential_array(labels: np.ndarray) -> np.ndarray
Remap labels to a contiguous 0, 1, … N range.
Background (0) stays 0. Runs in one np.unique + a lookup-table gather,
i.e. O(voxels) — unlike dask's relabel_sequential which is O(n_chunks²).
Examples:
Source code in src/blockbuster/_relabel.py
blockbuster.relabel_sequential_zarr(store_path: str, component: str = 'labels') -> int
Relabel a written label zarr to contiguous ids, in place. Returns N.
Two-pass streaming algorithm — safe for arrays far larger than RAM. Pass 1 collects unique ids (bounded memory: a set). Pass 2 applies the lookup-table remap chunk by chunk.