skimage 0.17.2

ParametersRaisesReturnsBackRef
remove_small_objects(ar, min_size=64, connectivity=1, in_place=False)

Expects ar to be an array with labeled objects, and removes objects smaller than min_size. If :None:None:`ar` is bool, the image is first labeled. This leads to potentially different behavior for bool and 0-and-1 arrays.

Parameters

ar : ndarray (arbitrary shape, int or bool type)

The array containing the objects of interest. If the array type is int, the ints must be non-negative.

min_size : int, optional (default: 64)

The smallest allowable object size.

connectivity : int, {1, 2, ..., ar.ndim}, optional (default: 1)

The connectivity defining the neighborhood of a pixel. Used during labelling if :None:None:`ar` is bool.

in_place : bool, optional (default: False)

If True , remove the objects in the input array itself. Otherwise, make a copy.

Raises

TypeError

If the input array is of an invalid type, such as float or string.

ValueError

If the input array contains negative values.

Returns

out : ndarray, same shape and type as input `ar`

The input array with small connected components removed.

Remove objects smaller than the specified size.

Examples

This example is valid syntax, but we were not able to check execution
>>> from skimage import morphology
... a = np.array([[0, 0, 0, 1, 0],
...  [1, 1, 1, 0, 0],
...  [1, 1, 1, 0, 1]], bool)
... b = morphology.remove_small_objects(a, 6)
... b array([[False, False, False, False, False], [ True, True, True, False, False], [ True, True, True, False, False]])
This example is valid syntax, but we were not able to check execution
>>> c = morphology.remove_small_objects(a, 7, connectivity=2)
... c array([[False, False, False, True, False], [ True, True, True, False, False], [ True, True, True, False, False]])
This example is valid syntax, but we were not able to check execution
>>> d = morphology.remove_small_objects(a, 6, in_place=True)
... d is a True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.morphology.max_tree.area_opening skimage.morphology.misc.remove_small_objects skimage.morphology.max_tree.area_closing

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/morphology/misc.py#51
type: <class 'function'>
Commit: