def _integrate_segmentation_masks(segmasks):
    """
    `segmasks` should be in sorted order of [coarsest, ..., finest].

    Integrates the given list of segmentation masks together to form one segmentation mask
    by having each segment subsume ones that exist in the finer masks.
    """
    if len(segmasks) == 1:
        return segmasks

    assert len(segmasks) > 0, "Passed in empty list of segmentation masks"
    coarse_mask = np.copy(segmasks[0])
    mask_ids = [id for id in np.unique(coarse_mask) if id != 0]
    for id in mask_ids:
        for mask in segmasks[1:]:
            finer_ids = [i for i in np.unique(mask) if i != 0]
            for finer_id in finer_ids:
                _update_segmentation_mask_if_overlap(coarse_mask, mask, id, finer_id)

    # Lastly, merge all adjacent blocks, but just kidding, since this algorithm is waaaay to slow
    #_merge_adjacent_segments(coarse_mask)
    return coarse_mask
`segmasks` should be in sorted order of [coarsest, ..., finest].

    Integrates the given list of segmentation masks together to form one segmentation mask
    by having each segment subsume ones that exist in the finer masks.