nddl.py 文件源码

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

项目:ndparse 作者: neurodata 项目源码 文件源码
def _make_border_mask(sz, borderSize, omitSlices=[]):
    """ Creates a logical tensor of size

        (#slices, #rows, #colums)

    where 1/true is an "included" pixel, where "included" means
      - not within borderSize pixels the edge of the xy plane
      - not within a slice that is to be omitted.
    """
    [s,m,n] = sz

    bitMask = np.ones(sz, dtype=bool)
    bitMask[omitSlices,:,:] = 0

    if borderSize > 0:
        bitMask[:, 0:borderSize, :] = 0
        bitMask[:, (m-borderSize):m, :] = 0
        bitMask[:, :, 0:borderSize] = 0
        bitMask[:, :, (n-borderSize):n] = 0

    return bitMask
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号