trim_disconnected_blobs#

trim_disconnected_blobs(im, inlets, strel=None)[source]#

Removes foreground voxels not connected to specified inlets.

Parameters:
  • im (ndarray) – The image containing the blobs to be trimmed

  • inlets (ndarray or tuple of indices) – The locations of the inlets. Can either be a boolean mask the same shape as im, or a tuple of indices such as that returned by the where function. Any voxels not connected directly to the inlets will be trimmed.

  • strel (array-like) – The neighborhood over which connectivity should be checked. It must be symmetric and the same dimensionality as the image. It is passed directly to the scipy.ndimage.label function as the structure argument so refer to that docstring for additional info.

Returns:

image – An array of the same shape as im, but with all foreground voxels not connected to the inlets removed.

Return type:

ndarray

See also

find_disconnected_voxels, find_nonpercolating_paths

Examples

Click here to view online example.