utils.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:pisap 作者: neurospin 项目源码 文件源码
def convert_mask_to_locations(mask):
    """ Return the converted Cartesian mask as sampling locations.

    Parameters
    ----------
    mask: np.ndarray, {0,1}
        2D matrix, not necessarly a square matrix.

    Returns
    -------
    samples_locations: np.ndarray
        list of the samples between [-0.5, 0.5[.
    """
    row, col = np.where(mask == 1)
    row = row.astype("float") / mask.shape[0] - 0.5
    col = col.astype("float") / mask.shape[1] - 0.5
    return np.c_[row, col]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号