merge_small_regions

helper.merge_small_regions(labels, min_size)

Merge small labeled regions (< min_size voxels) into neighboring larger regions.

Parameters: labels (ndarray): 3D numpy array of labeled regions. min_size (int): Minimum voxel count; regions smaller than this will be merged.

Returns: ndarray: Modified labels array with small regions merged.