neu_vol.ops.convert¶
Convert an existing volume (any source backend) into a multiscale zarr v3 or neuroglancer-precomputed volume, whole or cropped to a box.
Generalizes ingest: the source is any registered backend. Coordinate metadata
(voxel_size/offset/units/axes) is read from the source when it
carries it — OME-NGFF zarr groups, precomputed info, a DVID instance, and an HDF5
file that records its own frame beside the array; anything the caller passes explicitly
overrides the read value. Sources that record nothing (bare arrays, image stacks, a
plain HDF5 file) require the caller to supply at least voxel_size.
crop_start/crop_stop restrict the copy to a box without changing the model
space: the physical offset shifts by the crop origin, so the output lands on top of the
source in a viewer. The crop view wraps the resolved data_spec, so a cropped copy
reads through the reader detection chose. ops/roi.py is a thin wrapper over this.
Attributes¶
Functions¶
|
Convert |
|
|
Module Contents¶
- neu_vol.ops.convert.convert(src: str | dict, dst: str, *, voxel_size: Sequence[float] | None = None, src_format: str | None = None, src_level: int | None = None, units: str | None = None, axes: Sequence[str] | None = None, offset: Sequence[float] | None = None, has_channels: bool | None = None, crop_start: Sequence[int] | None = None, crop_stop: Sequence[int] | None = None, pad_value: float = 0, clip_crop: bool = True, mask_boxes: Sequence[Sequence[Sequence[int]]] | None = None, mask_value: float = 0, background: Sequence[int] | None = None, supervoxels: bool = False, prefer_locked: bool = False, wk_mapping: str | None = None, crop_to_data: bool = True, profile: str = 'local', chunk: Sequence[int] | None = None, shard: Sequence[int] | None = None, dtype: str | None = None, kind: str | None = None, encoding: str | None = None, compressed_segmentation_block_size: Sequence[int] = (8, 8, 8), multiscale: bool = True, factors: Sequence[Sequence[int]] | None = None, max_levels: int = 8, min_dim: int = 128, name: str = 'image', client: Any | None = None, npartitions: int | None = None, delete_existing: bool = False, resume: bool = False, verify: bool = False, sparse: bool = False, progress_path: str | None = None, validate: bool = True) dict¶
Convert
srcinto a multiscale volume atdst, whole or cropped.srcis a path or a full backend spec dict. For a path,src_formatis auto-detected unless given:info->precomputed,zarr.json->zarr3,.zarray/.zgroup->zarr2, advid://URL->dvid, and — from the name, since neither has a marker object — an HDF5 file or a glob, file or directory of 2D slices. Metadata not passed explicitly is taken from the source where available;voxel_sizeis required if the source carries none, which an image stack always does and an HDF5 file does unless it records its own frame.With
resume=Truean interrupted run continues, skipping already-done blocks instead of recreating them.backgroundnames the values the source uses for background (manual segmentation numbered from 0 makes it 1) and replaces them with 0 as the source is read. Afterwards is too late: an all-background block of 1s is not all-fill, so it would be stored.sparse=Trueskips pyramid tasks whose input holds no stored chunk, which on a sparse volume is nearly all of them. The level-0 copy is never skipped, since its source is foreign.mask_boxesis a list of spatial(lo, hi)pairs to exclude: everything else is copied and those regions are written asmask_value. Because the pyramid is derived from the output’s own level 0, the hole propagates to every level. A box that does not intersect the volume raises rather than quietly copying everything.crop_start/crop_stopcopy onlysrc[crop_start:crop_stop](spatial(z, y, x)voxels of the source’s level 0, either bound optional). The output’s physical offset shifts by the crop origin, so it stays in the source’s coordinate frame. The pyramid is built from the cropped level 0, so for a crop origin that is not a multiple of the cumulative factor, coarse voxels straddle the source’s differently.crop_to_data(default on) crops a source that records the box its data lies in (a webknossos layer’s bounding box) to that box when no crop is given, keeping the frame.Falsekeeps the full origin-anchored extent.
- neu_vol.ops.convert.with_source_options(spec: dict, *, prefer_locked: bool = False, supervoxels: bool = False, wk_mapping: str | None = None) dict¶
specwith the server-source read options set, each only when asked for.prefer_lockedandsupervoxelsapply to DVID,wk_mappingto webknossos. An option given for another source raises rather than being dropped: dropping it would read a different segmentation than the one asked for, and nothing downstream could tell. Unset options leave the spec’s own values alone.
- neu_vol.ops.convert.logger¶