join-segmentations

join_segmentations

skimage.segmentation.join_segmentations(s1, s2) [source]

Return the join of the two input segmentations.

The join J of S1 and S2 is defined as the segmentation in which two voxels are in the same segment if and only if they are in the same segment in both S1 and S2.

Parameters:

s1, s2 : numpy arrays

s1 and s2 are label fields of the same shape.

Returns:

j : numpy array

The join segmentation of s1 and s2.

Examples

>>> from skimage.segmentation import join_segmentations
>>> s1 = np.array([[0, 0, 1, 1],
...                [0, 2, 1, 1],
...                [2, 2, 2, 1]])
>>> s2 = np.array([[0, 1, 1, 0],
...                [0, 1, 1, 0],
...                [0, 1, 1, 1]])
>>> join_segmentations(s1, s2)
array([[0, 1, 3, 2],
       [0, 5, 3, 2],
       [4, 5, 5, 3]])
doc_scikit_image
2017-01-12 17:21:41
Comments
Leave a Comment

Please login to continue.