neu_morpho.ops.index_segments¶
Build the per-body metrics DB by a parallel scan of the segmentation.
Each block reports per-label bounding box and voxel count (full-res voxels); the driver merges them into the SQLite DB (min/max bbox, summed counts) atomically per block.
Consumers: voxel_count feeds the --min-voxels / --limit-bodies allowlist
(MetricsDB.write_allowlist), and the bbox one-off crops (crop_at_scale); meshing
and skeletonization are block-based and read neither. The bbox is the expensive half
(about 10x the counts per dense block), so for per-body volume alone prefer
neu-morpho measure volumes.
Functions¶
|
Scan |
Module Contents¶
- neu_morpho.ops.index_segments.index_segments(seg_spec: dict, db_path: str, *, scan_voxel_size: Sequence[float], scan_scale: int = 0, fullres_factor: Sequence[int] | None = None, block_shape: Sequence[int] = (256, 256, 256), roi: Sequence[int] | str | None = None, keep: Iterable[int] | None = None, client: Any | None = None, npartitions: int | None = None, resume: bool = True) dict¶
Scan
seg_spec(opened atscan_scale) and fill the per-body metrics DB.scan_voxel_size(nm, zyx) is that scale’s voxel size (for volume). Bbox is stored in full-res voxels viafullres_factor(default2**scan_scale).roi(scan-scale voxels) restricts the scan to the blocks intersecting it; the bboxes and counts then describe only the scanned part of each body.keeprestricts which bodies are recorded while every block is read in full, so its rows are complete: the knob for a fragmented segmentation. A different cohort later needs another scan.