def get_candidate_topleft_bottomright(image_dim, window_center, window_dim):
    """
    Given a desired window_center, compute the feasible (array-indexable)
    topleft and bottomright

    implicitly "zero-pads" if window cannot fit in image
    """
    half_dim = window_dim // 2
    rem_half_dim = window_dim - half_dim
    tl = window_center - half_dim
    offset = (-tl).clip(min=0)
    tl = tl.clip(min=0)
    br = window_center + rem_half_dim + offset
    br = br.clip(max=image_dim)
    return tl, br