def getMargin(patch_size):
    """
    Return patch margin size from a center point.
    """
    if (patch_size%2 == 0):
        raise ValueError("patch_size should be odd!")
    else:
        margin = (patch_size-1) // 2
        
    return margin