skimage 0.17.2

ParametersReturnsBackRef
clear_border(labels, buffer_size=0, bgval=0, in_place=False, mask=None)

Parameters

labels : (M[, N[, ..., P]]) array of int or bool

Imaging data labels.

buffer_size : int, optional

The width of the border examined. By default, only objects that touch the outside of the image are removed.

bgval : float or int, optional

Cleared objects are set to this value.

in_place : bool, optional

Whether or not to manipulate the labels array in-place.

mask : ndarray of bool, same shape as `image`, optional.

Image data mask. Objects in labels image overlapping with False pixels of mask will be removed. If defined, the argument buffer_size will be ignored.

Returns

out : (M[, N[, ..., P]]) array

Imaging data labels with cleared borders

Clear objects connected to the label image border.

Examples

This example is valid syntax, but we were not able to check execution
>>> import numpy as np
... from skimage.segmentation import clear_border
... labels = np.array([[0, 0, 0, 0, 0, 0, 0, 1, 0],
...  [1, 1, 0, 0, 1, 0, 0, 1, 0],
...  [1, 1, 0, 1, 0, 1, 0, 0, 0],
...  [0, 0, 0, 1, 1, 1, 1, 0, 0],
...  [0, 1, 1, 1, 1, 1, 1, 1, 0],
...  [0, 0, 0, 0, 0, 0, 0, 0, 0]])
... clear_border(labels) array([[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
This example is valid syntax, but we were not able to check execution
>>> mask = np.array([[0, 0, 1, 1, 1, 1, 1, 1, 1],
...  [0, 0, 1, 1, 1, 1, 1, 1, 1],
...  [1, 1, 1, 1, 1, 1, 1, 1, 1],
...  [1, 1, 1, 1, 1, 1, 1, 1, 1],
...  [1, 1, 1, 1, 1, 1, 1, 1, 1],
...  [1, 1, 1, 1, 1, 1, 1, 1, 1]]).astype(np.bool)
... clear_border(labels, mask=mask) array([[0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 1, 0, 0, 1, 0], [0, 0, 0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
See :

Back References

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

skimage.segmentation._clear_border.clear_border

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/segmentation/_clear_border.py#5
type: <class 'function'>
Commit: