对python读取CT医学图像的实例详解
作者:rongyongfeikai2 时间:2023-12-29 12:36:37
需要安装OpenCV和SimpleItk。
SimpleItk比较简单,直接pip install SimpleItk即可。
代码如下:
#coding:utf-8
import SimpleITK as sitk
import cv2
#LKDS-00058,-102.655469971,108.188810974,438.759994507,12.2279986879
if __name__ == '__main__':
filename = "F:/cancer_solution/data/train_subset00/LKDS-00058.mhd"
ds = sitk.ReadImage(filename)
img_array = sitk.GetArrayFromImage(ds)
frame_num, width, height = img_array.shape
outpath = "F:/cancer_solution/out/train/LKDS-00058"
index = -1
for img_item in img_array:
index = index + 1
cv2.imwrite("%s/%d.png"%(outpath,index),img_item)
print "done!"
如上所示,就将CT影像解析成了多个单幅图片。
目前还不太理解(x,y,z)坐标是如何对应的。
但祈世间人无病,何愁架上药生尘。癌症,终有一天可以被战胜。
来源:https://blog.csdn.net/rongyongfeikai2/article/details/72511140
标签:python,CT,图像
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
在Python的web框架中配置app的教程
2023-03-28 12:12:17
CentOS7安装Python3的教程详解
2023-10-17 02:40:28
浅析PHP中的字符串编码转换(自动识别原编码)
2023-09-08 08:04:44
python3中sorted函数里cmp参数改变详解
2022-11-11 17:21:49
Oracle 下的开发日积月累
2009-02-28 11:08:00
解决Pytorch内存溢出,Ubuntu进程killed的问题
2023-08-31 22:12:16
Rel与CSS的联合使用
2010-02-20 13:03:00
![](https://img.aspxhome.com/file/UploadPic/20102/20/e1-23s.png)
layui 富文本图片上传接口与普通按钮 文件上传接口的例子
2024-05-22 10:36:28
MySQL SELECT数据查看WHERE(AND OR IN NOT)语句
2024-01-25 16:05:22
SQL2005 学习笔记 窗口函数(OVER)
2024-01-27 09:50:49
layui 动态设置checbox 选中状态的例子
2024-04-18 09:28:05
Python实现识别图片为文字的示例代码
2022-01-02 14:57:48
![](https://img.aspxhome.com/file/2023/8/112538_0s.png)
Vue路由的懒加载深入详解
2024-05-28 16:03:58
![](https://img.aspxhome.com/file/2023/5/123075_0s.png)
Python如何创建装饰器时保留函数元信息
2023-03-29 12:32:46
基于python写个国庆假期倒计时程序
2022-06-04 20:35:32
![](https://img.aspxhome.com/file/2023/2/66802_0s.gif)
python实现跳表SkipList的示例代码
2022-04-05 05:01:53
![](https://img.aspxhome.com/file/2023/3/114783_0s.jpg)
详解python实现可视化的MD5、sha256哈希加密小工具
2021-05-31 15:02:34
![](https://img.aspxhome.com/file/2023/9/127899_0s.png)
Python爬虫Scrapy框架IP代理的配置与调试
2022-09-19 08:20:26
![](https://img.aspxhome.com/file/2023/0/94110_0s.png)
python实现关键词提取的示例讲解
2021-09-02 05:38:58
Linux下设置每天自动备份数据库的方法
2024-01-24 02:45:31
![](https://img.aspxhome.com/file/2023/8/69378_0s.png)