trim_small_clusters¶
- trim_small_clusters(im: ndarray[Any, dtype[_ScalarType_co]], size: int = 1)[source]¶
Remove isolated voxels or clusters of a given size or smaller
- Parameters:
im (ndarray) – The binary image from which voxels are to be removed.
size (scalar) – The threshold size of clusters to trim. As clusters with this many voxels or fewer will be trimmed. The default is 1 so only single voxels are removed.
- Returns:
im – A copy of im with clusters of voxels smaller than the given size removed.
- Return type:
ndarray
Examples
Click here to view online example.