DataSetAnalysis.py 文件源码

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

项目:ISLES2017 作者: MiguelMonteiro 项目源码 文件源码
def analyse_data(input_dir):

    shapes = []
    relative_volumes = []
    for folder in get_sub_folders(input_dir):
        print(folder)
        for sub_folder in get_sub_folders(os.path.join(input_dir, folder)):

            image_type = get_image_type_from_folder_name(sub_folder)

            # do not save the raw data (too heavy)
            if image_type != '.OT':
                continue

            path = os.path.join(input_dir, folder, sub_folder)
            filename = next(filename for filename in os.listdir(path) if get_extension(filename) == '.nii')
            path = os.path.join(path, filename)
            im = nib.load(path)
            image = im.get_data()
            shape = image.shape
            shapes.append(shape)
            relative_volumes.append(100 * np.sum(image) / np.cumprod(shape)[-1])
    return shapes, relative_volumes

# train
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号