def get_patch_centered(img, x, y, radius):
    """
    Extracts a patch from an image centered at (x, y) with a given radius.
    """
    return img[x - radius : x + radius + 1, y - radius : y + radius + 1]