neu_vol.ops.relabel¶
Give every occupied region of a sparse volume its own range of label ids.
Ground truth annotated chunk by chunk comes back with each chunk numbered from 1, so the same integer means a different cell in every chunk, and a mesh of one id is a dozen unrelated cells. This renumbers each occupied region into a range of its own.
The regions come from stored-chunk occupancy (
neu_vol.ops.occupancy), so they are pairwise disjoint; the run is serial, each range starting where the last ended.Boxes are not tightened: mode downsampling can drop a stray voxel, so a tightened box could leave level-0 data with its old id. The chunk-aligned box covers every stored chunk, and its writes are whole chunks.
The mapping is an output, written by default: it is the only way back from a new id to its region and original label.
Single-scale, like neu_vol.ops.write: run neu-vol downsample --start-level
<level> afterwards.
Attributes¶
Functions¶
|
Carry out a |
|
|
|
Resolve the geometry of the relabel. Reads chunk keys only; writes nothing. |
|
Plan and apply in one call. See |
Module Contents¶
- neu_vol.ops.relabel.apply_relabel(plan: dict, *, dry_run: bool = False, overwrite: bool = False, map_path: str | None = None) dict¶
Carry out a
plan_relabel(), returning the mapping and per-region summary.With
dry_runthe reads still happen — the mapping is only knowable from the voxels — but nothing is written and no destination is created.
- neu_vol.ops.relabel.default_map_path(destination: str, level: int) str¶
<last path component>.relabel-<level>.json, in the working directory.A default, so the mapping cannot be lost by forgetting a flag.
- neu_vol.ops.relabel.plan_relabel(volume: str, *, out: str | None = None, in_place: bool = False, level: int = 0, block_size: int | None = None, max_region_bytes: int = DEFAULT_MAX_REGION_BYTES, fmt: str | None = None) dict¶
Resolve the geometry of the relabel. Reads chunk keys only; writes nothing.
The id mapping needs the voxels, so
apply_relabel()resolves it (and reports it without writing whendry_run=True).
- neu_vol.ops.relabel.relabel(volume: str, *, out: str | None = None, in_place: bool = False, level: int = 0, block_size: int | None = None, max_region_bytes: int = DEFAULT_MAX_REGION_BYTES, dry_run: bool = False, overwrite: bool = False, map_path: str | None = None) dict¶
Plan and apply in one call. See
plan_relabel()andapply_relabel().
- neu_vol.ops.relabel.DEFAULT_MAX_REGION_BYTES = 8589934592¶