neu_proc.ops.dilate¶
Label dilation, three ways: edt, fastmorph and spherical.
edt runs on the GPU when one is available; the fastmorph methods have no GPU version
and move a GPU array to the CPU with a warning (cpu_only()).
``edt`` is unbounded unless given ``max_distance``. Every background voxel takes the
label of the nearest foreground voxel, so labels grow until they meet and no background is
left: a Voronoi partition, not a dilation by a radius. On a 16^3 array with two 2^3 seeds,
unbounded edt fills all 4096 voxels, fastmorph 128, spherical 64.
max_distance has the units of sampling: in nm with sampling=(z, y, x) in nm,
otherwise in voxels, which on an anisotropic volume grows labels lopsidedly in tissue.
The three methods take disjoint parameters (edt: sampling; spherical:
radius, anisotropy; fastmorph: iterations, mode). A parameter given to
the wrong method is refused with the name of the method that takes it.
Attributes¶
Functions¶
Module Contents¶
- neu_proc.ops.dilate.accepted(method: str, target=None) tuple[str, ...]¶
The keyword arguments
methodaccepts, read from the implementation’s signature.
- neu_proc.ops.dilate.dilate(arr, method: str = 'edt', *, max_distance: float | None = None, gpu: bool | None = None, **kwargs)¶
Grow the labels in
arr.max_distancebounds theedtmethod, which is otherwise unbounded; it has the units ofsampling(withsampling=(40, 8, 8), 80 means 80 nm), or voxels without it. Otherkwargsgo to the implementation, after a check that it takes them.With
edt, a CPU array is computed on the GPU when one is available, which is faster even counting both transfers (seebackend); the result is returned as numpy.gpu=False(orNEU_PROC_GPU=0) keeps it on the CPU.
- neu_proc.ops.dilate.METHODS¶