skimage 0.17.2

NotesParametersRaisesReturnsBackRef
remove_small_holes(ar, area_threshold=64, connectivity=1, in_place=False)

Notes

If the array type is int, it is assumed that it contains already-labeled objects. The labels are not kept in the output image (this function always outputs a bool image). It is suggested that labeling is completed after using this function.

Parameters

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

The array containing the connected components of interest.

area_threshold : int, optional (default: 64)

The maximum area, in pixels, of a contiguous hole that will be filled. Replaces :None:None:`min_size`.

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

The connectivity defining the neighborhood of a pixel.

in_place : bool, optional (default: False)

If :None:None:`True`, remove the connected components 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 holes within connected components removed.

Remove contiguous holes 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([[1, 1, 1, 1, 1, 0],
...  [1, 1, 1, 0, 1, 0],
...  [1, 0, 0, 1, 1, 0],
...  [1, 1, 1, 1, 1, 0]], bool)
... b = morphology.remove_small_holes(a, 2)
... b array([[ True, True, True, True, True, False], [ True, True, True, True, True, False], [ True, False, False, True, True, False], [ True, True, True, True, True, False]])
This example is valid syntax, but we were not able to check execution
>>> c = morphology.remove_small_holes(a, 2, connectivity=2)
... c array([[ True, True, True, True, True, False], [ True, True, True, False, True, False], [ True, False, False, True, True, False], [ True, True, True, True, True, False]])
This example is valid syntax, but we were not able to check execution
>>> d = morphology.remove_small_holes(a, 2, 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.misc.remove_small_holes skimage.morphology.max_tree.area_opening 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#142
type: <class 'function'>
Commit: