neu_vol.backends.view¶
Read-only view backends that wrap another backend.
CropBackend is a shifted/resized window over a source, padding out-of-bounds regions
with a fill value; MaskBackend blanks boxes to a fill value; RemapBackend replaces
values. Each opens from a spec, so the engine can crop, pad, mask and pyramid a region as it
would any other source.
Masking on the read side holds at every scale: each pyramid level is derived from the level below it in the output, so a hole in level 0 propagates upward on its own.
Attributes¶
Classes¶
A window |
|
A source with every box in |
|
A source with |
Module Contents¶
- class neu_vol.backends.view.CropBackend(spec: Mapping[str, Any])¶
A window
[origin, origin+shape)over a source backend (canonical order).originmay be negative andshapemay extend past the source; regions outside the source are filled withpad_value.- classmethod open(spec: Mapping[str, Any]) CropBackend¶
- read_region(region: neu_vol.backends.base.Region) numpy.ndarray¶
- to_spec() dict[str, Any]¶
- write_region(region: neu_vol.backends.base.Region, data: numpy.ndarray) None¶
- property chunks: tuple[int, ...]¶
- property dtype: numpy.dtype¶
- property shape: tuple[int, ...]¶
- class neu_vol.backends.view.MaskBackend(spec: Mapping[str, Any])¶
A source with every box in
boxesreplaced byvalue(canonical order).Boxes are full-ndim half-open
[lo, hi)in the source’s own index space, so a mask composes with a crop laid over it without either knowing about the other: the crop shifts coordinates, and this sits underneath.- classmethod open(spec: Mapping[str, Any]) MaskBackend¶
- read_region(region: neu_vol.backends.base.Region) numpy.ndarray¶
- to_spec() dict[str, Any]¶
- write_region(region: neu_vol.backends.base.Region, data: numpy.ndarray) None¶
- property chunks: tuple[int, ...]¶
- property dtype: numpy.dtype¶
- property shape: tuple[int, ...]¶
- class neu_vol.backends.view.RemapBackend(spec: Mapping[str, Any])¶
A source with
valuesreplaced byto(default 0) as it is read.For a segmentation whose background is not 0: a block of background 1s is not all-fill, so it gets stored, and “which chunks exist” stops answering “where is the data”, which occupancy,
relabeland--sparserely on. Remapping on the read side corrects it before the storage decision.- classmethod open(spec: Mapping[str, Any]) RemapBackend¶
- read_region(region: neu_vol.backends.base.Region) numpy.ndarray¶
- stored_axes(name: str = 'axes')¶
- stored_offset(name: str = 'voxel_offset')¶
- stored_voxel_size(name: str = 'voxel_size')¶
- to_spec() dict[str, Any]¶
- write_region(region: neu_vol.backends.base.Region, data: numpy.ndarray) None¶
- property chunks: tuple[int, ...]¶
- property dtype: numpy.dtype¶
- property shape: tuple[int, ...]¶
- neu_vol.backends.view.MASK_TAG = 'mask'¶
- neu_vol.backends.view.REMAP_TAG = 'remap'¶
- neu_vol.backends.view.TAG = 'crop'¶