inputs.py 文件源码

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

项目:segmentation 作者: zengyu714 项目源码 文件源码
def load_inference(base_path='./data/Test/Test_Subject', nii_index=0):
    """Load nii data, whose name is, for example, 'Test_Subject01.nii'.

    Arguments:
        nii_index: counts from 0.
    """
    filename = base_path + str(nii_index + 1).zfill(2) + '.nii'
    xs = nib.load(filename).get_data()

    # Crop black region to reduce nii volumes.
    dummy_ys = np.zeros_like(xs)
    xs, *_ = _banish_darkness(xs, dummy_ys)

    # Normalize images.
    local_max = np.max(xs, axis=(1, 2), keepdims=True)
    local_min = np.min(xs, axis=(1, 2), keepdims=True)
    xs = (xs - local_min) / (local_max - local_min)
    return xs[None, ..., None]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号