cellmap_flow.portable.carry
The paint of one annotation volume carried onto another model’s grid: the
maths of carry_paint (finetune/session/volume.py says what it is for),
on arrays alone, so the server runs it on its zarrs and the browser on its
paint store’s chunks (portable/calls.py).
Each new voxel takes the paint of the old voxels whose centres lie inside it (one for a grid as fine as the old, several for a coarser one), or, where none does (a finer grid), the old voxel its own centre lies in. A new voxel whose old voxels were painted different labels is left unpainted, on a boundary the coarser grid cannot draw; unpainted old voxels do not count against it, so a stroke thinner than the new voxel still lands, a voxel wide. Only the boxes of the old volume’s painted chunks are visited.
Classes
An annotation volume's grid, z y x: voxel 0's lower corner in nm (not |
Functions
|
Per voxel of |
|
The chunks (of |
|
The voxels of the box |
|
Carry the paint of the old volume's |
Module Contents
- class cellmap_flow.portable.carry.Grid
An annotation volume’s grid, z y x: voxel 0’s lower corner in nm (not the OME translation, which is its centre:
volume_corner_nm), its voxel size in nm, and its shape and chunks in voxels.- corner_nm: tuple
- voxel_nm: tuple
- shape: tuple
- chunks: tuple
- cellmap_flow.portable.carry.axis_sources(old: Grid, new: Grid, axis: int)
Per voxel of
newalongaxis, the voxels ofoldit takes, as(first, end)arrays (end <= first where none lies in the old volume): those whose centres lie inside it, or, when none does (a finer grid), the one its own centre lies in.
- cellmap_flow.portable.carry.parts(chunks, lo, shape) Iterator[Tuple[tuple, tuple, tuple]]
The chunks (of
chunksvoxels) the boxlo+shapetouches: each one’s index, the box’s part of it and the chunk’s part of the box, both as slices.
- cellmap_flow.portable.carry.first_visit(visited: dict, chunks, lo, shape) numpy.ndarray
The voxels of the box
lo+shapenot visited before, marking them visited invisited(a mask per chunk index ofchunks).
- cellmap_flow.portable.carry.carry(old: Grid, new: Grid, painted: Iterable[Tuple[tuple, numpy.ndarray]], read: Callable[[list, list], numpy.ndarray], dtype) Tuple[Dict[tuple, numpy.ndarray], dict]
Carry the paint of the old volume’s
paintedchunks (each its index and its labels, a whole chunk) onto the new grid.read(lo, hi)gives the old labels over a box in old voxels (several chunks’ worth, for a coarser new grid);dtypeis the new volume’s (its labels capped at its maximum).Returns the new chunks that got paint, by index, each whole (0 where the old paint says nothing: the caller writes them over what is there where they are not 0), and the counts
{"painted", "source", "conflicts", "chunks"}: the new voxels painted, the old painted voxels they came from, the new voxels left unpainted where their old voxels disagreed, and the new chunks returned.