def get_indices(pks, scale, center, shape, hkl=None):
    """Get the pixel indices for an image"""
    shapex, shapey = shape
    i, j = (pks * scale + center).astype(int).T
    sel = (0 < j) & (j < shapey) & (0 < i) & (i < shapex)
    if hkl is None:
        return i[sel], j[sel]
    else:
        return i[sel], j[sel], hkl[sel]