{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / segmentation / _join / join_segmentations

function

skimage.segmentation._join:join_segmentations

source: /dev/scikit-image/src/skimage/segmentation/_join.py :6

Signature

def   join_segmentations ( s1 s2 return_mapping : bool = False )

Summary

Return the join of the two input segmentations.

Extended Summary

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.

return_mapping : bool, optional

If true, return mappings for joined segmentation labels to the original labels.

Returns

j : numpy array

The join segmentation of s1 and s2.

map_j_to_s1 : ArrayMap, optional

Mapping from labels of the joined segmentation j to labels of s1.

map_j_to_s2 : ArrayMap, optional

Mapping from labels of the joined segmentation j to labels of 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)
j, m1, m2 = join_segmentations(s1, s2, return_mapping=True)
m1
np.all(m1[j] == s1)
np.all(m2[j] == s2)

Aliases

  • skimage.segmentation.join_segmentations