Command-line reference

Every zvtools subcommand and flag, generated from the parser itself. For what the options mean in practice, see Converting files, Store layout and Pyramids. python -m zarr_vectors_tools runs the same command.

Convert files into zarr-vectors stores with optional sparsity pyramids.

usage: zvtools [-h] [--version]
               {convert,pyramid,validate,info,synapses,bundles,attach,shard,index-faces,merge,split,run,virtual}
               ...

Positional Arguments

command

Possible choices: convert, pyramid, validate, info, synapses, bundles, attach, shard, index-faces, merge, split, run, virtual

Named Arguments

--version

show program’s version number and exit

Sub-commands

convert

Move data between a file and a zarr-vectors store. The direction comes from INPUT: a file is ingested into the store at OUTPUT, a store is exported to the file at OUTPUT (format from its extension).

zvtools convert [-h]
                [--format {auto,csv,edgelist,freesurfer,gifti,graphml,h5ad,las,lines,obj,ply,precomputed,stl,swc,table,tck,trk,trx}]
                [--chunk-shape X,Y,Z] [--num-chunks N|X,Y,Z]
                [--bin-shape X,Y,Z] [--dtype DTYPE] [--overwrite]
                [--coarsen C1,C2,...] [--sparsity S1,S2,...]
                [--chunk-scale K1,K2,...]
                [--sparsity-strategy {random,length,spatial_coverage,point_thinning,group,attribute}]
                [--sparsity-attribute NAME]
                [--method {auto,mesh,mesh_decimate,per_fragment,per_object,polyline,skeleton}]
                [--coarsen-mode {rdp,decimate}] [--rdp-tolerance T1,T2,...]
                [--cross-level-storage {none,implicit,explicit}]
                [--cross-level-depth N] [--refinement {replace,add}]
                [--compressor {none,zstd,blosc}] [--shard N|X,Y,Z]
                [--workers WORKERS] [--workers-backend {process,dask}]
                [--n-parts N_PARTS] [--scratch-dir DIR] [--resume]
                [--apply-affine] [--compute-length] [--compute-endpoints]
                [--object-attr NAME] [--vertex-attr NAME]
                [--attr-seed ATTR_SEED] [--nodes NODES]
                [--knn-distance-k KNN_DISTANCE_K] [--spatial-key KEY]
                [--spatial-columns I,J[,K]] [--obs-column NAME] [--no-obs]
                [--gene NAME] [--layer NAME] [--object-id-column NAME]
                [--backed] [--drop-na] [--position-columns X,Y[,Z]]
                [--key-column NAME] [--column NAME] [--delimiter DELIMITER]
                [--split-objects] [--no-merge-vertices]
                [--merge-tolerance DIST] [--geometry SURFACE]
                [--hemisphere {left,right,lh,rh}]
                [--space {auto,scanner,surface}] [--surface NAME]
                [--morph NAME] [--annot NAME] [--anchor X,Y,Z]
                [--counts NX,NY,NZ] [--frags-dir DIR] [--segment-id ID]
                [--lod N] [--drop-interior-below N] [--level LEVEL]
                [--object-id ID] [--group-id ID] [--bbox X0,Y0,Z0,X1,Y1,Z1]
                [--attribute NAME] [--object-attribute NAME] [--unit UNIT]
                [--prefix TEXT]
                input output

Positional Arguments

input

file to ingest (or a precomputed layer’s directory or URL), or store to export (decides the direction)

output

store to write (ingest), or file to write (export)

Named Arguments

--format

Possible choices: auto, csv, edgelist, freesurfer, gifti, graphml, h5ad, las, lines, obj, ply, precomputed, stl, swc, table, tck, trk, trx

format to use, instead of guessing from the extension: on ingest the INPUT’s, on export the OUTPUT’s (default: auto)

Default: 'auto'

--chunk-shape

level-0 chunk edge per axis, in the input’s coordinate units (required for every format except trk, which uses –num-chunks)

--num-chunks

trk only: target total chunk count, or per-axis counts

--bin-shape

bin edge inside a chunk (must divide the chunk shape; default: the chunk shape). Points, graphs and streamlines coarsen in multiples of it, so set it near the point spacing

--dtype

stored position dtype (default: float32)

Default: 'float32'

--overwrite

replace an existing output store

Default: False

--compressor

Possible choices: none, zstd, blosc

trk only: codec for per-chunk arrays (default: none = raw). zstd and blosc compress them losslessly, but the zarr-vectors Neuroglancer viewer cannot read compressed chunk arrays: keep stores meant for viewing uncompressed

Default: 'none'

--shard

after conversion, pack per-chunk cells into shards of N chunks per axis (one file per shard instead of one per chunk) – far fewer files for cloud upload. 8 = 8x8x8 ~512 chunks/shard. Omit to leave unsharded

--workers

parallel worker processes (default backend needs no extra)

--workers-backend

Possible choices: process, dask

parallel backend: ‘process’ (stdlib, default) or ‘dask’ (needs the [parallel] extra)

Default: 'process'

--n-parts

trk: file-split granularity

--scratch-dir

trk: keep the intermediate part files and a progress record here instead of a temporary directory

--resume

trk: reuse what an earlier run with the same options finished in –scratch-dir (the file scan, Phase A, level 0, finished pyramid levels)

Default: False

--apply-affine

trk only (rejected for other inputs): bake the vox_to_ras affine into vertex positions (RAS world space) and store an identity crs affine. Simpler for viewers that can’t apply an affine themselves (e.g. neuroglancer). Default: keep raw voxmm coordinates + the real affine in crs

Default: False

--compute-length

streamlines: store per-object length

Default: False

--compute-endpoints

streamlines: store per-object endpoints

Default: False

--object-attr

Possible choices: length, endpoints, orientation, tortuosity, vertex_count

trk: generate a per-object (per-streamline) attribute for color-by-object testing (repeatable). Choices: length, endpoints, orientation (start->end unit vector, 3ch DEC), tortuosity, vertex_count (written for every store with objects anyway)

--vertex-attr

Possible choices: arc_length, x, y, z, random, index, tangent

trk: generate a per-vertex (per-point) attribute for color-by-vertex testing (repeatable). Choices: arc_length (0->1 along each streamline), x/y/z (coordinate), random, index (0->1 within streamline), tangent (per-vertex unit direction, 3ch DEC)

--attr-seed

seed for the ‘random’ attribute generators (default: 0)

Default: 0

--nodes

edgelist: path to the node CSV (second input)

--knn-distance-k

points: k for kNN-distance enrichment (needs [points-enrichment])

pyramid (coarser levels)

--coarsen

one entry per coarser level, each relative to the level below: points/graphs/meshes multiply the bin edge, skeletons and –coarsen-mode decimate take a vertex stride, streamlines in rdp mode derive their tolerance from it (see –rdp-tolerance). Values must be >= 1; default 1 at each level when only –sparsity is given

--sparsity

one entry per coarser level: divide the objects kept at the level below by this (1 = keep all, 2 = half). Compounds: 2,2,2 keeps 1/2, 1/4, 1/8 of level 0. Default 1 at each level when only –coarsen is given

--chunk-scale

one entry per coarser level: multiply the chunk edge of the level below by this. Compounds: 2,2,2 gives 2x, 4x, 8x the level-0 chunk

--sparsity-strategy

Possible choices: random, length, spatial_coverage, point_thinning, group, attribute

which objects survive sparsification (default: random); ‘attribute’ keeps the highest values of –sparsity-attribute

Default: 'random'

--sparsity-attribute

with –sparsity-strategy attribute: the per-object attribute (object_attributes/NAME on level 0) to rank objects by

--method

Possible choices: auto, mesh, mesh_decimate, per_fragment, per_object, polyline, skeleton

how coarser levels are built (default auto: chosen from the store’s geometry). Meshes: mesh_decimate collapses edges and keeps a closed surface closed (each –coarsen entry is the factor to shrink the level’s data by; –sparsity must be 1), mesh clusters vertices (the auto choice, and the one that drops objects). Points and streamlines: per_fragment thins each fragment in place. A method that does not fit the store’s geometry is refused

Default: 'auto'

--coarsen-mode

Possible choices: rdp, decimate

streamline/polyline vertex reduction (default: rdp)

Default: 'rdp'

--rdp-tolerance

streamlines, rdp mode: per-level Douglas-Peucker tolerance, the furthest a level may stray from the level below, in store units (e.g. mm). One per –coarsen entry. Default: half the smallest edge of each level’s bin

--cross-level-storage

Possible choices: none, implicit, explicit

links between pyramid levels: ‘explicit’ writes both directions (the default when omitted), ‘implicit’ fine-to-coarse only, ‘none’ skips them

--cross-level-depth

largest level gap to link (default 1; -1 = every pair of levels)

--refinement

Possible choices: replace, add

‘replace’ (default): every level is complete. ‘add’: store each object (or point) once, at the coarsest level that keeps it; every level but the coarsest then holds only what the next coarser one lacks, and readers show the union. LEVEL 0 IS REWRITTEN IN PLACE. Exact for streamline/polyline sparsity with –coarsen 1; warns for meshes and for coarsened levels

Default: 'replace'

h5ad (AnnData)

--spatial-key

h5ad: obsm key holding the coordinates (default: auto – tries spatial, X_spatial, spatial_fov, X_umap, X_tsne, X_pca)

Default: 'auto'

--spatial-columns

h5ad: which columns of the embedding to use as positions (default: the first up-to-3)

--obs-column

h5ad: obs column to store as a vertex attribute (repeatable; default: all of them). Use –no-obs to store none

--no-obs

h5ad: do not store any obs columns

Default: False

--gene

h5ad: store this gene’s expression as a vertex attribute (repeatable; default: none)

--layer

h5ad: read expression from layers[NAME] instead of X

--object-id-column

h5ad: obs column grouping cells into Zarr Vectors objects (e.g. cell_type, sample)

--backed

h5ad: leave X on disk (AnnData backed mode); helps on large files when –gene selects few columns

Default: False

--drop-na

h5ad: drop cells whose coordinates contain NaN (table input drops them by default)

Default: False

table (keyed delimited table)

--position-columns

table: column names holding the coordinates, in axis order (required for –format table)

--key-column

table: column holding the row identifier. Hashed into the join key so later files can be staged in with ‘zvtools attach’

--column

table: metadata column to store as a vertex attribute (repeatable; default: every non-position, non-key column)

--delimiter

csv/table input, and CSV export: column delimiter. ‘whitespace’ (or ‘ ‘) is runs of spaces and tabs, ‘tab’ a tab. Default: csv input reads it from the first row (a comma if it has one, else whitespace), table input uses a comma, export a comma (a space for .xyz)

meshes (obj, stl)

--split-objects

obj: one object per ‘o’ or ‘g’ group, named after it (default: the whole file is one mesh)

Default: False

--no-merge-vertices

stl: keep each triangle’s three vertices separate instead of welding the copies STL repeats per face

Default: False

--merge-tolerance

stl: weld vertices that round to the same point of a grid this fine, in the file’s units (default: 1e-6; 0 welds exact copies only)

cortical surfaces (gifti, freesurfer)

--geometry

surface to chunk: midthickness, pial, white, smoothwm, orig (default: midthickness; gifti falls back to the first of those it finds). Every other surface is kept as coords_<name>

--hemisphere

Possible choices: left, right, lh, rh

freesurfer: hemispheres to read (repeatable; default both). gifti: the hemisphere of files that do not name one. gifti export: which hemispheres to write

--space

Possible choices: auto, scanner, surface

freesurfer: scanner RAS (add c_ras, lines up with volumes and tracts) or FreeSurfer surface RAS. auto = scanner when the files record c_ras. gifti: auto applies each surface’s transform matrix when it leads to a named space, scanner requires scanner RAS, surface keeps positions as stored (default: auto)

Default: 'auto'

--surface

freesurfer: other surfaces to keep (repeatable; default white, pial, inflated, sphere when present). gifti export: which surfaces to write (default all)

--morph

freesurfer: morphometry maps from surf/ (repeatable; default thickness, curv, sulc, area when present)

--annot

freesurfer: parcellations from label/ (repeatable; default aparc when present), e.g. aparc.a2009s

precomputed (Neuroglancer skeleton or mesh layer)

A skeleton layer with a spatial index keeps its own chunk grid, so –chunk-shape is left out; one without needs –chunk-shape, in nm, and –coarsen gives each level’s decimation stride. A mesh layer (the mesh directory, not the segmentation above it) needs –chunk-shape too, and builds its pyramid like any mesh input.

--anchor

spatial index: voxel corner of one .frags chunk; ingest the block from there instead of every chunk in the layer

--counts

spatial index: .frags chunks per axis from –anchor (default: 1,1,1)

--frags-dir

spatial index: subdirectory holding the .frags files (default: the layer root)

Default: ''

--segment-id

no spatial index, or a mesh layer: ingest only this segment (repeatable; default: every segment in the layer)

--lod

multi-resolution mesh layer: level of detail to read (default: 0, the finest)

--drop-interior-below

at each coarser level, drop objects of at most N vertices that touch no chunk boundary (default: 0, keep all)

Default: 0

export (store -> file)

--level

resolution level to export (default: 0, the finest)

Default: 0

--object-id

export only these objects (repeatable)

--group-id

streamlines: export only these groups/bundles (repeatable)

--bbox

export only what falls in this box

--attribute

per-vertex attributes to include (repeatable). csv/ply write none by default; h5ad, trk and trx write every one they can unless this names them

--object-attribute

trk/trx: per-streamline attributes to include (repeatable; default: every numeric one)

--unit

precomputed: the store’s coordinate unit (nanometer, micrometer, millimeter) when its metadata does not record one

--prefix

gifti: leading file-name part, e.g. sub-01 gives sub-01_hemi-L_pial.surf.gii

pyramid

Build coarser resolution levels on an existing store (auto geometry routing).

zvtools pyramid [-h] [--coarsen C1,C2,...] [--sparsity S1,S2,...]
                [--chunk-scale K1,K2,...]
                [--sparsity-strategy {random,length,spatial_coverage,point_thinning,group,attribute}]
                [--sparsity-attribute NAME]
                [--method {auto,mesh,mesh_decimate,per_fragment,per_object,polyline,skeleton}]
                [--coarsen-mode {rdp,decimate}] [--rdp-tolerance T1,T2,...]
                [--cross-level-storage {none,implicit,explicit}]
                [--cross-level-depth N] [--refinement {replace,add}]
                [--replace] [--compressor {none,zstd,blosc}]
                [--workers WORKERS] [--workers-backend {process,dask}]
                store

Positional Arguments

store

existing zarr-vectors store path

Named Arguments

--replace

remove the store’s existing coarse levels first (without it, a store that has any is refused)

Default: False

--compressor

Possible choices: none, zstd, blosc

codec for the coarser levels’ per-chunk arrays (default: none = raw). Match the value level 0 was written with; the zarr-vectors Neuroglancer viewer reads only uncompressed chunk arrays

Default: 'none'

--workers

parallel worker processes (default backend needs no extra)

--workers-backend

Possible choices: process, dask

parallel backend: ‘process’ (stdlib, default) or ‘dask’ (needs the [parallel] extra)

Default: 'process'

pyramid (coarser levels)

--coarsen

one entry per coarser level, each relative to the level below: points/graphs/meshes multiply the bin edge, skeletons and –coarsen-mode decimate take a vertex stride, streamlines in rdp mode derive their tolerance from it (see –rdp-tolerance). Values must be >= 1; default 1 at each level when only –sparsity is given

--sparsity

one entry per coarser level: divide the objects kept at the level below by this (1 = keep all, 2 = half). Compounds: 2,2,2 keeps 1/2, 1/4, 1/8 of level 0. Default 1 at each level when only –coarsen is given

--chunk-scale

one entry per coarser level: multiply the chunk edge of the level below by this. Compounds: 2,2,2 gives 2x, 4x, 8x the level-0 chunk

--sparsity-strategy

Possible choices: random, length, spatial_coverage, point_thinning, group, attribute

which objects survive sparsification (default: random); ‘attribute’ keeps the highest values of –sparsity-attribute

Default: 'random'

--sparsity-attribute

with –sparsity-strategy attribute: the per-object attribute (object_attributes/NAME on level 0) to rank objects by

--method

Possible choices: auto, mesh, mesh_decimate, per_fragment, per_object, polyline, skeleton

how coarser levels are built (default auto: chosen from the store’s geometry). Meshes: mesh_decimate collapses edges and keeps a closed surface closed (each –coarsen entry is the factor to shrink the level’s data by; –sparsity must be 1), mesh clusters vertices (the auto choice, and the one that drops objects). Points and streamlines: per_fragment thins each fragment in place. A method that does not fit the store’s geometry is refused

Default: 'auto'

--coarsen-mode

Possible choices: rdp, decimate

streamline/polyline vertex reduction (default: rdp)

Default: 'rdp'

--rdp-tolerance

streamlines, rdp mode: per-level Douglas-Peucker tolerance, the furthest a level may stray from the level below, in store units (e.g. mm). One per –coarsen entry. Default: half the smallest edge of each level’s bin

--cross-level-storage

Possible choices: none, implicit, explicit

links between pyramid levels: ‘explicit’ writes both directions (the default when omitted), ‘implicit’ fine-to-coarse only, ‘none’ skips them

--cross-level-depth

largest level gap to link (default 1; -1 = every pair of levels)

--refinement

Possible choices: replace, add

‘replace’ (default): every level is complete. ‘add’: store each object (or point) once, at the coarsest level that keeps it; every level but the coarsest then holds only what the next coarser one lacks, and readers show the union. LEVEL 0 IS REWRITTEN IN PLACE. Exact for streamline/polyline sparsity with –coarsen 1; warns for meshes and for coarsened levels

Default: 'replace'

validate

run conformance validation on a store

zvtools validate [-h] [--level LEVEL] store

Positional Arguments

store

zarr-vectors store path

Named Arguments

--level

conformance level 1-5 (default: 3)

Default: 3

info

print store geometry, levels, and metadata

zvtools info [-h] store

Positional Arguments

store

zarr-vectors store path

synapses

Write a CAVE-style synapse table as a point store whose object ids are the skeleton store’s, and count each neuron’s pre- and post-synaptic sites onto it.

zvtools synapses [-h] [--side {post,pre}] [--position COLUMN]
                 [--resolution X,Y,Z] [--chunk-shape X,Y,Z] [--column NAME]
                 [--unmatched {keep,drop,error}] [--no-counts]
                 table skeletons output

Positional Arguments

table

synapse table: .csv, .tsv, or .parquet with pyarrow

skeletons

skeleton store with per-object segment ids

output

point store to write

Named Arguments

--side

Possible choices: post, pre

whose segment owns each synapse (default: post)

Default: 'post'

--position

position column, ‘[x y z]’ strings or COLUMN_x/_y/_z (default: ctr_pt_position)

Default: 'ctr_pt_position'

--resolution

nanometres per voxel of the positions, e.g. 4,4,40 (default: 1,1,1)

Default: [1.0, 1.0, 1.0]

--chunk-shape

chunk size in nm (default: the skeleton store’s)

--column

further numeric column to keep (repeatable)

--unmatched

Possible choices: keep, drop, error

synapses whose segment the skeleton store lacks (default: keep as one extra object)

Default: 'keep'

--no-counts

do not write synapse counts to the skeleton store

Default: False

bundles

One row per group: streamline count, length statistics, mean tortuosity and endpoint centroids, written to the store as group attributes unless –no-write.

zvtools bundles [-h] [--level LEVEL] [--no-write] [--as-stored] [--csv FILE]
                store

Positional Arguments

store

zarr-vectors streamline store path

Named Arguments

--level

summarise this level from its own geometry and write it there only (default: level 0, written to every level)

--no-write

print the table without storing it

Default: False

--as-stored

average endpoints as stored instead of orienting each bundle

Default: False

--csv

also write the table to this CSV file

attach

Add per-vertex attributes to an existing store, matching rows to points on a join key. Lets a dataset split across several files be imported one file at a time instead of being merged into a single large file first.

zvtools attach [-h] [--format {auto,h5ad,table,cifti}] [--name NAME]
               [--column NAME] [--gene NAME] [--gene-by COL] [--layer NAME]
               [--key-column NAME] [--key-attribute NAME]
               [--delimiter DELIMITER] [--level LEVEL]
               [--missing {fill,error}] [--overwrite] [--shard N|X,Y,Z]
               store input

Positional Arguments

store

existing zarr-vectors store path (modified in place)

input

file to stage in (.h5ad, a delimited table, or a .dscalar/.dlabel/.dtseries.nii onto a surface store)

Named Arguments

--format

Possible choices: auto, h5ad, table, cifti

source format (default: auto from extension)

Default: 'auto'

--name

cifti only: attribute name (default: from the filename). On a multi-map dscalar, keeps the maps together as one multi-column attribute

--column

column to stage in (repeatable). h5ad: an obs column. table: any column. Default for tables: every non-key column

--gene

h5ad only: gene whose expression to stage in (repeatable). Matched against var_names, then gene_symbol

--gene-by

h5ad only: var column to match –gene against

--layer

h5ad only: read expression from layers[NAME] instead of X

--key-column

column holding the identifier to join on. Required for tables; for h5ad defaults to the obs index

--key-attribute

store attribute holding the join key (default: zv_join_key)

Default: 'zv_join_key'

--delimiter

table only: column delimiter (default: ,)

Default: ','

--level

resolution level to write into (default: 0)

Default: 0

--missing

Possible choices: fill, error

what to do for points absent from the incoming file (default: fill with NaN / -1)

Default: 'fill'

--overwrite

replace attributes that already exist

Default: False

--shard

create the new attribute arrays sharded, packing N chunks per axis into one file. Set this when staging many columns: unsharded costs one file per chunk per attribute, and resharding afterwards has to reread every one. Match the value across attaches

shard

Pack per-chunk cells into shards (few large files, good for cloud upload) or reverse it. Data and coordinates are unchanged; only the on-disk file layout differs.

zvtools shard [-h] [--shape N|X,Y,Z] [--unshard] store

Positional Arguments

store

zarr-vectors store path

Named Arguments

--shape

shard size in chunks per axis (default 8 = 8x8x8). Ignored with –unshard

Default: 8

--unshard

remove sharding (back to one file per chunk)

Default: False

index-faces

Regroup each chunk’s intra-chunk faces one group per vertex fragment (object), and stamp the level fragment_link_groups once every chunk is checked, so a viewer drawing one object can read just its faces rather than the whole chunk. Face data is unchanged, and usually only the link_fragments index is rewritten; a level where some face spans two objects is left unstamped. Meshes written by zarr-vectors-py and pyramids built by zvtools pyramid are already stamped. Needs a zarr-vectors-py with fragment_link_groups support, and refuses to run without it.

zvtools index-faces [-h] [--levels L1,L2,...] [--dry-run] [--verify] store

Positional Arguments

store

zarr-vectors store path

Named Arguments

--levels

levels to index (default: all)

--dry-run

report what would change without writing

Default: False

--verify

re-check levels already stamped instead of skipping them: repair them where possible, and withdraw the stamp where not

Default: False

merge

Append objects to a store that already exists, carrying their attributes, group taxonomy and format headers, and rebuilding the pyramid the write invalidates. Unlike convert, nothing already in the target is replaced.

zvtools merge [-h]
              [--format {trk,trx,tck,swc,obj,stl,ply,las,csv,h5ad,table,lines,edgelist,graphml,gifti,freesurfer,precomputed,auto}]
              [--create] [--cell-size X,Y,Z] [--space {voxmm,ras}]
              [--transform FILE|CSV] [--group-by ATTR] [--lut FILE]
              [--group-prefix GROUP_PREFIX] [--source-attr NAME]
              [--on-out-of-bounds {raise,skip,expand}]
              [--pyramid {rebuild,drop,keep}] [--pyramid-coarsen C1,C2,...]
              [--pyramid-sparsity S1,S2,...]
              [--sparsity-strategy {random,length,spatial_coverage,point_thinning,group}]
              [--coarsen-mode {rdp,decimate}] [--dry-run]
              target sources [sources ...]

Positional Arguments

target

store to merge into

sources

files and/or stores to merge in

Named Arguments

--format

Possible choices: trk, trx, tck, swc, obj, stl, ply, las, csv, h5ad, table, lines, edgelist, graphml, gifti, freesurfer, precomputed, auto

input format for file sources (default: from extension)

--create

create the target if absent, sized from the sources

Default: False

--cell-size

grid cell size for a created target

--space

Possible choices: voxmm, ras

trk only: keep stored coordinates (voxmm, default) or apply the header affine to reach RAS mm

Default: 'voxmm'

--transform

affine to apply to every source, as a .npy, a .json, or comma-separated numbers in row-major order

--group-by

turn this per-object attribute into named groups

--lut

JSON {name: code} lookup naming the –group-by values

--group-prefix

namespace incoming group names (default: same name extends the existing group)

--source-attr

stamp a per-object attribute with each source’s index

--on-out-of-bounds

Possible choices: raise, skip, expand

geometry outside the target’s grid: refuse (default), drop it, or grow the grid upwards to fit (never below its first cell)

Default: 'raise'

--pyramid

Possible choices: rebuild, drop, keep

what to do with the coarse levels a merge invalidates (default: rebuild)

Default: 'rebuild'

--pyramid-coarsen

per-level coarsen factors for the rebuild (default: each existing level’s recorded settings)

--pyramid-sparsity

per-level sparsity divisors for the rebuild

--sparsity-strategy

Possible choices: random, length, spatial_coverage, point_thinning, group

which objects survive sparsification (default: random). ‘group’ thins each named group by the same factor with a floor of one, so no group is ever lost

Default: 'random'

--coarsen-mode

Possible choices: rdp, decimate

streamline/polyline vertex reduction (default: rdp). rdp’s tolerance is half the smallest edge of each level’s bin, which the coarsen factors multiply, so it compounds across levels; ‘decimate’ strides compound too

Default: 'rdp'

--dry-run

print the plan – ids, offsets, whether it fits – and stop

Default: False

split

The inverse of merge. Each part keeps the parent’s grid by default, so the pieces stay cell-aligned with it and with each other.

zvtools split [-h] [--by {groups,attribute,provenance}] [--attribute NAME]
              [--lut FILE] [--level LEVEL] [--bounds {source,fit}]
              [--pyramid {rebuild,drop}] [--pyramid-coarsen C1,C2,...]
              [--pyramid-sparsity S1,S2,...]
              [--sparsity-strategy {random,length,spatial_coverage,point_thinning,group}]
              [--coarsen-mode {rdp,decimate}] [--min-objects N] [--overwrite]
              [--dry-run]
              store output

Positional Arguments

store

store to split

output

directory to write the parts into

Named Arguments

--by

Possible choices: groups, attribute, provenance

how to cut (default: the store’s named object groups)

Default: 'groups'

--attribute

per-object attribute to cut on, for –by attribute

--lut

JSON {name: code} lookup naming the attribute values

--level

resolution level to read from (default: 0)

Default: 0

--bounds

Possible choices: source, fit

keep the parent’s grid (default) or size each part to its own contents

Default: 'source'

--pyramid

Possible choices: rebuild, drop

pyramid for each part: rebuild the parent’s levels from the part (or the levels –pyramid-coarsen / –pyramid-sparsity give), or none (default: drop, or rebuild when –pyramid-coarsen/–pyramid-sparsity is given)

--pyramid-coarsen

per-level coarsen factors for each part’s pyramid (default: the parent’s levels)

--pyramid-sparsity

per-level sparsity divisors for each part’s pyramid

--sparsity-strategy

Possible choices: random, length, spatial_coverage, point_thinning, group

which objects survive sparsification (default: random). The parent does not record it: pass the one it was built with

Default: 'random'

--coarsen-mode

Possible choices: rdp, decimate

streamline/polyline vertex reduction for –pyramid-coarsen (default: rdp). The parent’s levels are rebuilt in the mode each records

Default: 'rdp'

--min-objects

skip parts with fewer than N objects

Default: 1

--overwrite

replace parts that already exist

Default: False

--dry-run

print the parts and their sizes, and stop

Default: False

run

Run the steps a recipe lists (convert, pyramid, attach, merge, split, validate, info, shard), each with the same options as its own command. Progress is kept next to the recipe, so a rerun skips the steps that already finished.

zvtools run [-h] [--force] [--from N] [--dry-run] recipe

Positional Arguments

recipe

recipe file: .yaml, .toml or .json

Named Arguments

--force

rerun every step, even ones that finished

Default: False

--from

rerun from step N (1-based) onward

--dry-run

print each step’s zvtools command, and stop

Default: False

virtual

Read tractograms (.trk, .tck, .trx), meshes (.obj, .stl, .ply, .gii, FreeSurfer surfaces), SWC neurons or point tables (.csv, .tsv, .xyz) once and serve each as a virtual zarr-vectors store over HTTP, for any Neuroglancer with the zarr-vectors data source. Nothing is written.

zvtools virtual [-h] {serve} ...

Positional Arguments

virtual_command

Possible choices: serve

Sub-commands

serve

serve each file as a zarr-vectors store at http://host:port/<name>/

zvtools virtual serve [-h] [--host HOST] [--port PORT] files [files ...]
Positional Arguments
files

.trk, .tck, .trx, .obj, .stl, .ply, .gii, FreeSurfer surface (lh.pial, …), .swc, .csv, .tsv or .xyz files

Named Arguments
--host

Default: '127.0.0.1'

--port

Default: 8000