neu_morpho.coords

The coordinate contract that keeps meshes and skeletons aligned.

Both live in one model space, physical nanometres (full-resolution world coords, zyx), with identity neuroglancer transforms. Every scale is expressed through its own voxel size (nm), never an assumed 2**scale, so anisotropic pyramids stay aligned.

  • Mesh: Mesh.from_label_volume(block, physical_box(region, voxel_size)) yields nm.

  • Skeleton: a tracer run with anisotropy = voxel_size returns nm local to the crop; skeleton_to_physical() adds the crop origin, the step whose omission offsets skeletons from their meshes.

Functions

block_chunk_shape_xyz(block_shape_zyx, voxel_size_zyx) → list[float]

Octree LOD-0 cell size in nm (xyz) for the multires writer = block extent in nm.

crop_origin_nm(origin_vox_zyx, voxel_size_zyx) → numpy.ndarray

Physical (nm) origin of a crop given its origin in that scale's voxels.

physical_box(region, voxel_size_zyx[, origin_nm_zyx]) → numpy.ndarray

Physical (nm) bounding box (2x3, zyx) for a block region at a scale.

skeleton_to_physical(vertices_nm_zyx, origin_nm_zyx) → numpy.ndarray

Shift crop-local skeleton vertices (nm) to global physical nm (zyx), by adding the

Module Contents

neu_morpho.coords.block_chunk_shape_xyz(block_shape_zyx: Sequence[int], voxel_size_zyx: Sequence[float]) → list[float]

Octree LOD-0 cell size in nm (xyz) for the multires writer = block extent in nm.

neu_morpho.coords.crop_origin_nm(origin_vox_zyx: Sequence[int], voxel_size_zyx: Sequence[float]) → numpy.ndarray

Physical (nm) origin of a crop given its origin in that scale’s voxels.

neu_morpho.coords.physical_box(region: Sequence[slice], voxel_size_zyx: Sequence[float], origin_nm_zyx: Sequence[float] = (0.0, 0.0, 0.0)) → numpy.ndarray

Physical (nm) bounding box (2x3, zyx) for a block region at a scale.

region is in that scale’s array indices; voxel_size_zyx is its voxel size (nm) and origin_nm_zyx where its index 0 lies (the level’s Frame), so the box lands in the same nm world whatever the scale or the volume’s offset.

neu_morpho.coords.skeleton_to_physical(vertices_nm_zyx: numpy.ndarray, origin_nm_zyx: Sequence[float]) → numpy.ndarray

Shift crop-local skeleton vertices (nm) to global physical nm (zyx), by adding the crop origin; the tracer must already have returned nm.