scikit-image/scikit-image — pull request #377 by jni (2012-11-28 02:01:52+00:00)
Title: Add functions to join and relabel segmentations

Hey guys! Hope things are going well since SciPy.

Recently I've needed a function that would take the "intersection" of two segmentations, which I've seen referred to as the "join" (see for example Marina Meila, "Comparing clusterings -- an information based distance", Journal of Multivariate Analysis, 98, pp 873-895, 2007.). Given two segmentations S1 and S2, the join J is 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.

(I could rename this "intersect" if you prefer, but I haven't seen that name used before.)

A helpful function for this is one that relabels a segmentation with arbitrary (integer) labels to 1...num_labels, so I added that.