neu_vol.profiles

Storage target profiles: destination-aware chunk/shard/compression defaults.

Decouples the viewer-facing read chunk from the on-disk file/object size and picks sensible defaults per destination. All values are overridable at call sites.

  • local : zarr v3, 128^3 chunks, unsharded (dev / smoke test)

  • cephzarr v3, 128^3 read chunks packed into ~1024^3 shards

    (sharding codec) -> few inodes, quota-safe intermediates

  • s3-neuroglancer : precomputed, gzip, unsharded (web viewing)

  • local-neuroglancer : the same, on a filesystem

Attributes

Classes

StorageProfile

Destination-aware storage defaults for the spatial axes.

Functions

get_profile(profile) → StorageProfile

precomputed_create_spec(profile, location, ...[, ...]) → dict

Build a normalized neuroglancer-precomputed create spec (one scale).

zarr3_create_spec(profile, location, shape, dtype, *) → dict

Build a normalized zarr3 create spec (for TensorStoreBackend.create).

Module Contents

class neu_vol.profiles.StorageProfile

Destination-aware storage defaults for the spatial axes.

chunk: tuple[int, ...]
compressor: str | None = 'zstd'
compressor_level: int | None = None
format: str
shard: tuple[int, ...] | None = None
neu_vol.profiles.get_profile(profile: str | StorageProfile) → StorageProfile
neu_vol.profiles.precomputed_create_spec(profile: str | StorageProfile, location: str | Mapping[str, Any], canonical_shape: Sequence[int], dtype: str, *, resolution_zyx: Sequence[float], scale_index: int, num_channels: int = 1, chunk: Sequence[int] | None = None, encoding: str = 'raw', type_: str = 'image', voxel_offset_zyx: Sequence[int] | None = None, compressed_segmentation_block_size: Sequence[int] | None = None) → dict

Build a normalized neuroglancer-precomputed create spec (one scale).

canonical_shape/resolution_zyx/chunk are in canonical (z, y, x) order (with a leading channel axis when num_channels > 1); the backend reverses them to precomputed’s native (x, y, z). For encoding="compressed_segmentation" a block size (canonical z,y,x) is required (defaults to 8,8,8).

neu_vol.profiles.zarr3_create_spec(profile: str | StorageProfile, location: str | Mapping[str, Any], shape: Sequence[int], dtype: str, *, has_channels: bool = False, num_channels: int = 1, dimension_names: Sequence[str] | None = None, chunk: Sequence[int] | None = None, shard: Sequence[int] | None = None) → dict

Build a normalized zarr3 create spec (for TensorStoreBackend.create).

location is a local path, s3://… URL, or kvstore dict. chunk/ shard override the profile’s spatial values. A leading channel axis (full extent) is added automatically when has_channels.

neu_vol.profiles.PROFILES: dict[str, StorageProfile]