neu_proc.ops.opening¶
Spherical morphological opening, label-aware: opening().
An erosion then a dilation, to remove thin protrusions and one-voxel bridges.
fastmorph.spherical_open does it in one pass without merging bodies.
The result is not guaranteed to be a subset of the input, unlike a mathematical
opening, because fastmorph’s erosion and dilation read radius differently. On a 10^3
box, radius=1 erodes nothing and dilates to 1600 voxels, so it is a pure dilation;
radius=2 removes a one-voxel shell but returns 1384 voxels. Sizes measured after an
opening are therefore not comparable to sizes before it. opening() warns at a radius
too small to erode.
radius is in the units of anisotropy when given, otherwise in voxels.
Functions¶
|
Erode then dilate the labels in |
Module Contents¶
- neu_proc.ops.opening.opening(arr, radius: float, *, anisotropy=None, **kwargs)¶
Erode then dilate the labels in
arr, removing thin structure.opening(labels, 2) # a one-voxel shell off and back opening(labels, 80, anisotropy=(40, 8, 8)) # 80 nm, on an anisotropic volume
radiusis in the units ofanisotropywhen given, otherwise voxels. The result may be larger than the input (see the module docstring).Runs on the CPU; a GPU array is copied off and back with a warning.