neu_vol.backends.tensorstore

TensorStore-backed reader/writer for zarr v3 and neuroglancer-precomputed.

Primary read/write engine. Handles array chunk data and codecs (incl. the zarr v3 sharding codec). .chunks reports the array-level chunk shape — the shard when sharding is on — which is the write-block granularity the engine tiles by.

Axis order: everything the engine sees is canonical (z, y, x) / (c, z, y, x). zarr v3 arrays are created in that order directly. Precomputed is natively (x, y, z, channel); this backend presents a transposed view and reads with order="C" so canonical, C-contiguous arrays reach the engine.

Attributes

Classes

TensorStoreBackend

Wraps a tensorstore.TensorStore (canonical view) behind ArrayBackend.

Module Contents

class neu_vol.backends.tensorstore.TensorStoreBackend(store: Any, tag: str, kvstore: Mapping[str, Any], scale_index: int | None = None)

Wraps a tensorstore.TensorStore (canonical view) behind ArrayBackend.

classmethod create(spec: Mapping[str, Any], *, delete_existing: bool = False) → TensorStoreBackend
is_region_stored(region: neu_vol.backends.base.Region) → bool

True if region is already fully written (authoritative, for verify).

zarr3 uses TensorStore’s storage_statistics. precomputed’s storage_statistics is broken in this TensorStore version, so we check the chunk object directly via the kvstore (valid for unsharded precomputed where one engine block == one chunk, which is our S3 case).

classmethod open(spec: Mapping[str, Any]) → TensorStoreBackend
classmethod open_or_create(spec: Mapping[str, Any], *, resume: bool, delete_existing: bool = False) → TensorStoreBackend

Create the store, or (when resume) open it if it already exists.

On resume, an existing store with a matching shape is opened (so already written blocks survive); otherwise it is created fresh.

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 read_chunks: tuple[int, ...]
property shape: tuple[int, ...]
neu_vol.backends.tensorstore.TAGS = ('zarr3', 'zarr2', 'neuroglancer_precomputed')