Ingest workflows¶
Each ingest function reads one source format and writes a Zarr Vectors
store. There are no re-exports — zarr_vectors_tools/convert/ingest/__init__.py
is empty, so every import names its module in full.
# Always import from the module, never from the package.
from zarr_vectors_tools.convert.ingest.csv_points import ingest_csv
result = ingest_csv(
"transcripts.csv", # source file
"transcripts.zv", # path for the new store (must not exist)
(50.0, 50.0, 50.0), # chunk_shape — required, positional
bin_shape=None, # optional supervoxel bin size
# ... format-specific options ...
)
result["vertex_count"] # summary dict from the underlying writer
Two entry points break that shape: ingest_edgelist takes an edge CSV
and a node CSV before output_path, and ingest_trk_parallel takes no
chunk_shape at all — it derives the grid from num_chunks.
The returned dict is whatever the zarr-vectors writer produced
(write_points, write_lines, write_polylines, write_graph,
write_mesh), plus enrichment counters such as dropped_by_length,
dropped_na, or dropped_duplicates.
Format matrix¶
Generated from FORMAT_REGISTRY in
zarr_vectors_tools/cli/_args.py — the single place that maps a
--format key to extensions, module, entry function, and extra.
Format |
CLI |
Ingest function |
Zarr Vectors geometry |
Extra required |
|---|---|---|---|---|
CSV / XYZ point cloud |
|
|
points |
none |
LAS / LAZ |
|
|
points |
|
PLY (points) |
|
|
points |
|
AnnData |
|
|
points |
|
Keyed table |
|
|
points |
none |
CSV line segments |
|
|
lines |
none |
TrackVis TRK |
|
|
streamlines |
|
TRX |
|
|
streamlines |
|
MRtrix TCK |
|
|
streamlines |
|
SWC |
|
|
skeleton |
none |
Edge-list CSV pair |
|
|
graph |
|
GraphML |
|
|
graph |
|
Wavefront OBJ |
|
|
mesh |
none |
STL |
|
|
mesh |
none |
GIFTI surfaces |
|
|
mesh (one object per hemisphere) |
|
FreeSurfer subject |
|
|
mesh (one object per hemisphere) |
|
Neuroglancer precomputed skeletons or meshes |
|
|
skeleton or mesh (one object per segment ID) |
|
Install an extra with pip install "zarr-vectors-tools[las]", or
[all] for the lot. Python 3.11 or newer is required.
Warning
lines, edgelist and table register no file extensions, so they
can never be auto-detected — the CLI requires an explicit --format. A
.csv input with no --format resolves to csv, i.e. a point cloud,
silently and successfully. Pass --format lines, --format edgelist or
--format table when the CSV is not a numeric point table.
table is the CSV path for rows carrying a stable identifier: it reads
through pandas (so string and categorical columns work, where csv’s
numpy.loadtxt path needs everything numeric) and hashes the identifier
into a join key, so further files can be staged into the store afterwards.
See Single-cell and spatial omics.
gifti and freesurfer also accept a directory, because one subject’s
cortex is many files. A FreeSurfer subject is recognised by
surf/lh.white or surf/rh.white, and any other directory holding .gii
files resolves to gifti. CIFTI files carry no geometry, so they are staged
onto a surface store with zvtools attach instead. See
Cortical surfaces.
precomputed reads a layer, which is a directory or a bucket prefix: any
URL resolves to it, since no other ingester reads one, as does a local
directory holding an info file. ingest_precomputed reads that info
and hands a skeleton layer to precomputed_skeletons.run_ingest when it
has a spatial_index, or to precomputed_plain_skeletons.run_ingest_plain
when it does not. A mesh layer goes to
precomputed_meshes.ingest_precomputed_meshes. See
Skeletons in EM and
Meshes.
trk and precomputed are the registry entries with
inline_pyramid=True: the ingest builds the multiscale pyramid itself
rather than leaving it to a follow-up build_pyramid call. A precomputed
mesh layer is the exception, and builds its pyramid afterwards like any
other mesh. See Tractography at scale.
Ingests not in the CLI registry¶
One entry point is reachable from Python only:
Function |
Source |
Extra |
|---|---|---|
|
TRK, serial whole-file read via |
|
ingest_trk is the serial sibling of ingest_trk_parallel. --format trk
on the CLI always routes to the parallel path; reach for the serial one
in Python when the file is small enough to hold in RAM and you want the
nibabel reader’s data_per_point / data_per_streamline handling.
Geometry pages¶
Point clouds — CSV/XYZ, LAS/LAZ, PLY
Single-cell and spatial omics — AnnData
.h5ad, keyed tables, and staging a multi-file dataset into one storeLines — line-segment CSV
Tractography — TCK, TRK, TRX
Tractography at scale — the parallel TRK pipeline
Skeletons — SWC
Skeletons in EM — precomputed / CloudVolume sources
Graphs — edge-list CSV, GraphML
Meshes — OBJ, STL
Cortical surfaces — GIFTI, FreeSurfer, and CIFTI maps attached onto them
Attribute names produced by the enrichment options are listed in full at Enrichments.
Headers and round-trip¶
Several formats carry metadata that is not part of the geometry: TRK
voxel-to-RAS affines, SWC comment lines, OBJ object names, CSV
normalisation offset and scale. These are written to /headers/<format>/
so the matching export_* can recover them. Header preservation is
best-effort — a failure there never fails the ingest. See
Headers.