LabelingFilter

Filter for calculating labels.

Labels a buffer using the Hoshen–Kopelman algorithm to first label all of the connected components, then does a second pass to count the number of voxels in each unique label.

The Hoshen–Kopelman labelling is slightly modified to work with non-binary 3D data, but is otherwise structured the same way.

Ref: https://en.wikipedia.org/wiki/Hoshen%E2%80%93Kopelman_algorithm.