neu_vol.ops.maskvalue

Replace label values with background, in a volume that already has them.

For a segmentation whose background is not 0 (a tool numbering labels from 0 makes it 1): meshed, background becomes one enormous body, and an all-background block of 1s is not all-fill, so it is stored, after which “which chunks exist” no longer says where the data is. The better fix is at ingest (--background on write/to-hdf5/convert); this op is for data that has already landed.

Both destinations restore the sparsity: writing zeros over a stored chunk deletes the object. --out is still preferred, so the original stays as the record of what was annotated. Single-scale: run neu-vol downsample --start-level <level> afterwards.

Attributes

Functions

apply_mask_values(plan, *[, dry_run, overwrite, max_bytes]) → dict

Carry out a plan_mask_values(), returning what it changed.

mask_values(volume, values, *[, out, in_place, level, ...]) → dict

Plan and apply in one call. See plan_mask_values().

plan_mask_values(volume, values, *[, out, in_place, ...]) → dict

What apply_mask_values() would do. Reads metadata and occupancy only.

Module Contents

neu_vol.ops.maskvalue.apply_mask_values(plan: dict, *, dry_run: bool = False, overwrite: bool = False, max_bytes: int = DEFAULT_BLOCK_BYTES) → dict

Carry out a plan_mask_values(), returning what it changed.

Counts are exact: replaced of 0 means nothing matched, and already_background above 0 means two labels have just become one.

neu_vol.ops.maskvalue.mask_values(volume: str, values: Sequence[int], *, out: str | None = None, in_place: bool = False, level: int = 0, to: int = 0, dry_run: bool = False, overwrite: bool = False) → dict

Plan and apply in one call. See plan_mask_values().

neu_vol.ops.maskvalue.plan_mask_values(volume: str, values: Sequence[int], *, out: str | None = None, in_place: bool = False, level: int = 0, to: int = 0) → dict

What apply_mask_values() would do. Reads metadata and occupancy only.

Exactly one of out / in_place, as in relabel.

neu_vol.ops.maskvalue.DEFAULT_BLOCK_BYTES = 2147483648
neu_vol.ops.maskvalue.logger