cellmap_flow.io.source
Reading array data with tensorstore, whatever the format.
open_array(path) gives an ArraySource for zarr v2 and v3, N5 and
neuroglancer precomputed, on local disk or at an http(s)://, s3:// or
gs:// URL (io.store). Every format is seen
the same way: C order, as the metadata in io.metadata describes it
(channels first, then z, y, x), with voxel 0 at index 0. read_padded
reads a Box of voxels from it, or from any view of it, padding what
lies outside the array.
Where the voxels are in the world is io.geometry’s business, and what
the input chain does to them is ImageDataInterface’s.
Attributes
Classes
One array, read with tensorstore: every channel, not normalized. |
Functions
|
The array at |
|
The voxels of |
Module Contents
- cellmap_flow.io.source.logger
- class cellmap_flow.io.source.ArraySource(path: str, concurrency_limit: int | None = 1, cache_bytes: int = 0)
One array, read with tensorstore: every channel, not normalized.
Opened on first use and then kept, so everything sharing the source (ImageDataInterface’s
with_input_normsviews) shares one open store, and its cache.- path
- concurrency_limit = 1
- cache_bytes = 0
- property ts
C order, voxel 0 at index 0.
- Type:
The tensorstore
- read(box: cellmap_flow.io.geometry.Box | None = None, fill=0) numpy.ndarray
read_paddedof this array: all of it whenboxis None.
- cellmap_flow.io.source.open_array(path: str, concurrency_limit: int | None = 1, cache_bytes: int = 0) ArraySource
The array at
path, to read with tensorstore; it is opened on the first read (a missing or unreadable array raises then).concurrency_limit: how many files tensorstore reads and chunks it decodes at once;Noneleaves its defaults (one decode per core).cache_bytes: how much decoded data it keeps for later reads of the same chunks (0: none). Cached chunks are still checked against the file on every read, so what is read never differs.
- cellmap_flow.io.source.read_padded(store, box: cellmap_flow.io.geometry.Box | None = None, fill=0, transform=None) numpy.ndarray
The voxels of
box(one entry per dimension ofstore; all of it when None) as a numpy array, padded where the box runs past the store’s domain.fillis the padding value, or “edge” to repeat the border voxels: each voxel outside the array takes the value of the nearest one inside. A box wholly outside the array is all padding.transformis applied to what was read before the padding is added: ImageDataInterface runs its input chain there, so padding is never normalized, and a box with nothing to read still has the chain’s dtype.