Multiresolution

A resolution pyramid stores the same geometry several times over at decreasing detail, so a viewer can stream the level that matches its current zoom instead of the whole dataset. Neuroglancer and similar clients pull the coarsest level first and refine downwards; a query that only needs a global answer reads level 3 and never touches level 0, which is what keeps peak memory bounded on a store larger than RAM.

from zarr_vectors_tools.multiresolution.coarsen import build_pyramid

# Two coarser levels on an existing store.  Each tuple is
# (coarsen_factor, sparsity_factor) and produces one level:
#   level 1 = level 0 coarsened 8x, keeping 1/2 of the objects
#   level 2 = level 1 coarsened 8x, keeping 1/4 of what survived
summary = build_pyramid(
    "tracts.zv",
    factors=[(8.0, 2.0), (8.0, 4.0)],
    sparsity_strategy="length",   # keep the longest objects at each level
    sparsity_seed=0,              # advanced per level internally: seed + i
)

summary["levels_created"]   # 2
summary["method"]           # the coarsener the store's metadata dispatched to

build_pyramid picks the coarsening strategy from the store’s own root metadata — you do not name it. See strategies.md for the dispatch table.

The two axes

A pyramid level is produced by two independent reductions: coarsen_factor reduces vertices within each object, sparsity_factor drops whole objects. They compose but do not substitute for one another, and conflating them is the usual first mistake. concepts.md works through the distinction in depth; the rest of this section assumes it.

Pages

Page

Covers

concepts.md

Coarsening versus sparsity — the two axes, in depth

building_pyramids.md

build_pyramid, coarsen_level, and the zvtools pyramid CLI

strategies.md

How a coarsener is selected, and what each one does

object_selection.md

The five selectors, apply_sparsity, and its two footgun parameters

cross_level_links.md

cross_level_storage, cross_level_depth, and the ±N link families

refresh.md

Re-coarsening a pyramid after a level has been edited

Who owns what

The parent package deliberately ships only a basic, dependency-free multiresolution layer: the per_object binning pyramid and random object selection, plus a plug-in strategy registry reached through its supported zarr_vectors.building.register_coarsen_strategy and register_selection_strategy entry points. Everything richer — skeleton and polyline coarsening, spatial-coverage / length / attribute / point-thinning selection, and the third-party dependencies they need — lives in this package.

Importing zarr_vectors_tools registers this package’s strategies into that registry, which widens what the parent package will accept:

import zarr_vectors as zv

zv.coarsen_methods()          # ('per_object',)

import zarr_vectors_tools     # noqa: F401  — registers on import

zv.coarsen_methods()          # ('per_object', 'polyline', 'skeleton')

zarr_vectors.coarsen_methods() is the supported way to ask what is available in a given installation, rather than passing a name and finding out from the exception.

The registration is one-directional. Tools depends on the parent package; the parent package never depends on tools, and degrades quietly (the registry import is wrapped in a try/except ImportError) against a core that predates the registry.

Note

Build pyramids through this package’s build_pyramid (above), or through the parent package’s supported surface. zarr_vectors.multiresolution is internal to that package and may change without notice — see the API reference.

Note

Pyramid refresh is the one piece not injected this way. EditSession(refresh_pyramid=...) uses core’s own basic refresher — see refresh.md for the workaround.

See also