trim_disconnected_blobs¶
- trim_disconnected_blobs(im: ndarray[Any, dtype[_ScalarType_co]], inlets: ndarray[Any, dtype[_ScalarType_co]], conn: Literal['max', 'min'] = 'min')[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.
conn (str) – Can be either ‘min’ or ‘max’ and controls the shape of the structuring element used to determine voxel connectivity. The default if ‘min’ which imposes the strictest criteria, so that voxels must share a face to be considered connected.
- 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.