栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Brats2020数据集的读取—>python中对.nii格式数据读取

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Brats2020数据集的读取—>python中对.nii格式数据读取

Brats2020数据集的读取—>python中对.nii格式数据读取


首先要安装了torchio,安装指令:

pip install torchio

torchio:一个 Python 库,用于在深度学习中高效加载、预处理、增强和基于补丁的医学图像采样。

其次是找到.nii数据的相对位置或者绝对位置,修改到自己代码的相应位置。代码如下:

import torchio as tio
flair_path = './data/MICCAI_BraTS2020_TrainingData/BraTS20_Training_003/BraTS20_Training_003_flair.nii'
t1_path = './data/MICCAI_BraTS2020_TrainingData/BraTS20_Training_003/BraTS20_Training_003_t1.nii'
t1ce_path = './data/MICCAI_BraTS2020_TrainingData/BraTS20_Training_003/BraTS20_Training_003_t1ce.nii'
t2_path = './data/MICCAI_BraTS2020_TrainingData/BraTS20_Training_003/BraTS20_Training_003_t2.nii'
seg_path = './data/MICCAI_BraTS2020_TrainingData/BraTS20_Training_003/BraTS20_Training_003_seg.nii'


flair_img = tio.ScalarImage(flair_path)
t1_img = tio.ScalarImage(t1_path)
t1ce_img = tio.ScalarImage(t1ce_path)
t2_img = tio.ScalarImage(t2_path)
seg_img = tio.LabelMap(seg_path)

flair_img.plot()
t1_img.plot()
t1ce_img.plot()
t2_img.plot()
seg_img.plot()

显示结果:

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/835381.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号