neu_draw.sources¶
The only module that reads data; everything else takes arrays.
Reads meshes and skeletons from a neuroglancer-precomputed volume, resolves a pyramid
level to a Frame, and turns a synapse table into point arrays.
Subdirectory names come from the volume’s own info, never assumed: they vary (one
volume declares {"mesh": "mesh", "skeletons": "skeleton"}), and a wrong guess reads
back as every body having no skeleton. A level’s voxel size comes from the metadata,
never 2 ** level. Meshes and skeletons are stored in nm and need no frame.
Attributes¶
Exceptions¶
The volume's |
Functions¶
|
One body's mesh at one LOD, or |
|
Meshes for many bodies, fetched concurrently. Missing bodies are omitted. |
|
One body's skeleton, or |
|
Skeletons for many bodies, fetched concurrently. Missing bodies are omitted. |
|
An |
|
Every pyramid level, finest first, each with its own voxel size |
|
The subdirectory holding |
|
Split a synapse table by kind into |
|
The |
|
The volume's own |
Module Contents¶
- exception neu_draw.sources.MissingSubresource¶
Bases:
RuntimeErrorThe volume’s
infodeclares no meshes or no skeletons.Initialize self. See help(type(self)) for accurate signature.
- neu_draw.sources.body_mesh(volume: str, body_id: int, *, lod: int | None = None, cache: Any = None, name: str | None = None, mesh_dir: str | None = None, info: Mapping | None = None) neu_lib.Mesh | None¶
One body’s mesh at one LOD, or
Noneif the volume holds none for it.loddefaults to the coarsest present, the cheapest to draw; pass 0 for full detail.
- neu_draw.sources.body_meshes(volume: str, body_ids: Iterable[int], *, cache: Any = None, names: Mapping[int, str] | None = None, threads: int = DEFAULT_THREADS, skip_missing: bool = True, **kwargs) dict[int, neu_lib.Mesh]¶
Meshes for many bodies, fetched concurrently. Missing bodies are omitted.
skip_missingcovers only bodies the volume does not hold. A volume declaring no meshes, or storing them in a format the reader cannot decode, raises either way.
- neu_draw.sources.body_skeleton(volume: str, body_id: int, *, cache: Any = None, name: str | None = None, skeleton_dir: str | None = None, info: Mapping | None = None, require_radii: bool = True) neu_lib.Skeleton | None¶
One body’s skeleton, or
Noneif the volume holds none for it.require_radii=Falseaccepts a source that publishes centrelines only, with every radius the-1sentinel (FlyEM’s male-CNS does).
- neu_draw.sources.body_skeletons(volume: str, body_ids: Iterable[int], *, cache: Any = None, names: Mapping[int, str] | None = None, threads: int = DEFAULT_THREADS, skip_missing: bool = True, **kwargs) dict[int, neu_lib.Skeleton]¶
Skeletons for many bodies, fetched concurrently. Missing bodies are omitted.
skip_missingcovers only bodies the volume does not hold. A volume declaring no skeletons, or storing them in a format the reader cannot decode, raises either way.
- neu_draw.sources.points_from_table(table: Any, *, frame: neu_lib.Frame | None = None, columns: Sequence[str] = ('z', 'y', 'x'), prefix: str = '') numpy.ndarray¶
An
(N, 3)zyx nm array from a table with named coordinate columns.columnsare read in the order given, so the default yields zyx from neu-mark’s tables. Passframewhen the table holds voxel indices (DVID’s do) rather than nm. Columns are looked up by name, never by position, so the axis order is explicit.
- neu_draw.sources.scales(volume: str, *, refresh: bool = False) list¶
Every pyramid level, finest first, each with its own voxel size (
neu_vol.read_scales). Memoized;refresh=Truere-reads.
- neu_draw.sources.subresource_dir(volume: str, kind: str, info: Mapping | None = None) str¶
The subdirectory holding
kind("mesh"or"skeletons"), frominfo.Raises rather than guessing, since a wrong name would read back as every body having no mesh.
- neu_draw.sources.synapse_points(table: Any, *, frame: neu_lib.Frame | None = None, kind_column: str = 'kind', columns: Sequence[str] = ('z', 'y', 'x'), prefix: str = '') dict[str, numpy.ndarray]¶
Split a synapse table by kind into
{kind: (N, 3) zyx nm}.Keys are the column’s values (DVID’s are
PreSynandPostSyn). A table with no kind column becomes a single"points"entry.
- neu_draw.sources.volume_frame(volume: str, level: int = 0) neu_lib.Frame¶
The
Frame(voxel size and origin) of one pyramid level, from the volume’s metadata.
- neu_draw.sources.volume_info(volume: str) dict¶
The volume’s own
info, as a dict.
- neu_draw.sources.DEFAULT_THREADS = 8¶