python 读取DICOM头文件的实例
作者:sunyao_123 时间:2021-12-03 19:30:48
用dicompyler软件打开dicom图像,头文件如图所示:
当然也可以直接读取:
ds = dicom.read_file('H:\Data\data\\21662\\2.16.840.1.113662.2.0.105002416.1489146183.701\CT\\CT#0#21662#E7AB693D.dcm')
print ds
>>
(0008, 0008) Image Type CS: ['ORIGINAL', 'SECONDARY', 'AXIAL']
(0008, 0016) SOP Class UID UI: CT Image Storage
(0008, 0018) SOP Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.501.0
(0008, 0020) Study Date DA: '20170310'
(0008, 0021) Series Date DA: '20170310'
(0008, 0023) Content Date DA: '20060505'
(0008, 0030) Study Time TM: '1942'
(0008, 0031) Series Time TM: '1942'
(0008, 0033) Content Time TM: ''
(0008, 0050) Accession Number SH: '63071'
(0008, 0060) Modality CS: 'CT'
(0008, 0070) Manufacturer LO: 'NOMOS'
(0008, 0090) Referring Physician's Name PN: ''
(0008, 1010) Station Name SH: ''
(0008, 1090) Manufacturer's Model Name LO: 'CORVUS 6.4'
(0010, 0010) Patient's Name PN: '*M32-2^CHENJUN^^^'
(0010, 0020) Patient ID LO: '21662'
(0010, 0030) Patient's Birth Date DA: ''
(0010, 0040) Patient's Sex CS: ''
(0018, 0050) Slice Thickness DS: '4.75'
(0018, 0060) KVP DS: '0'
(0018, 1020) Software Version(s) LO: 'CORVUS 6.4'
(0018, 5100) Patient Position CS: 'HFS'
(0020, 000d) Study Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.701
(0020, 000e) Series Instance UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.501
(0020, 0010) Study ID SH: '63071'
(0020, 0011) Series Number IS: '0'
(0020, 0012) Acquisition Number IS: '0'
(0020, 0013) Instance Number IS: '0'
(0020, 0020) Patient Orientation CS: ['L', 'P']
(0020, 0032) Image Position (Patient) DS: ['0.73437356948853', '0', '3.25']
(0020, 0037) Image Orientation (Patient) DS: ['1', '0', '0', '0', '1', '0']
(0020, 0052) Frame of Reference UID UI: 2.16.840.1.113662.2.0.105002416.1489146183.601
(0020, 0060) Laterality CS: ''
(0020, 1040) Position Reference Indicator LO: ''
(0020, 1041) Slice Location DS: '3.25'
(0028, 0002) Samples per Pixel US: 1
(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'
(0028, 0010) Rows US: 330
(0028, 0011) Columns US: 339
(0028, 0030) Pixel Spacing DS: ['0.734375', '0.734375']
(0028, 0100) Bits Allocated US: 16
(0028, 0101) Bits Stored US: 12
(0028, 0102) High Bit US: 11
(0028, 0103) Pixel Representation US: 0
(0028, 1052) Rescale Intercept DS: '-1024'
(0028, 1053) Rescale Slope DS: '1'
(7fe0, 0010) Pixel Data
发现一套图的第一张和最后一张的Slice Thickness往往和中间层的值是不同的。
Path = 'H:\Data\data\\21662\\2.16.840.1.113662.2.0.105002416.1489146183.701\CT\\a.dcm'
slices = dicom.read_file(path)
spacing = slices.PixelSpacing
读取头文件信息方法:
Slices.上图头文件中的name列。
这时要注意的是,name大小写不变,去掉空格,去掉符号,比如括号。
举例:
origin = slices.SoftwareVersions
print origin
>>CORVUS 6.4
spacing = slices[1].PixelSpacing
print spacing
>>['0.734375', '0.734375']
来源:https://blog.csdn.net/sunyao_123/article/details/73655897
标签:python,头文件,DICOM
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python实现超快窗口截图功能详解
2023-11-05 13:54:07
![](https://img.aspxhome.com/file/2023/5/63945_0s.png)
PHP strip_tags() 去字符串中的 HTML、XML 以及 PHP 标签的函数
2023-06-09 01:05:00
关于jupyter打开之后不能直接跳转到浏览器的解决方式
2023-07-17 01:39:55
![](https://img.aspxhome.com/file/2023/2/63532_0s.jpg)
基于PHP常用文件函数和目录函数整理
2023-06-09 22:02:34
一种弹出提示信息时页面背景色调改变的方法
2008-12-01 12:22:00
asp 随机字符串函数
2011-04-04 11:01:00
数据安全之MySQL安全的二十三条军规
2008-12-24 16:26:00
python3去掉string中的标点符号方法
2021-06-27 01:29:45
windows7下调试ASP+ACCESS错误“未找到提供程序 该程序可能未正确安装”解决办法
2009-12-26 18:35:00
![](https://img.aspxhome.com/file/UploadPic/20101/11/20091119044705-94s.jpg)
制作一个更漂亮一些的多选列表框
2007-10-16 13:04:00
![](https://img.aspxhome.com/file/UploadPic/200710/16/2007101613723940s.gif)
Python NumPy实用函数笔记之allclose
2023-08-24 18:09:12
PyQt5每天必学之切换按钮
2023-06-14 09:07:06
![](https://img.aspxhome.com/file/2023/8/59648_0s.png)
网页设计中怎么将px换成em
2008-04-16 13:50:00
JS 去前后空格大全(IE9亲测)
2013-08-22 13:01:43
深入理解Python分布式爬虫原理
2023-02-06 14:33:30
![](https://img.aspxhome.com/file/2023/8/66458_0s.jpg)
jquery中文手册上的一点错误--说说p标签失去焦点
2009-09-13 21:24:00
![](https://img.aspxhome.com/file/UploadPic/20099/13/c88879ae2c3bd9614bc01e7e8f79ce54-99s.jpg)
如何解决django配置settings时遇到Could not import settings 'conf.local'
2021-07-23 13:31:57
微信小程序地图定位的实现方法实例
2023-08-25 10:13:10
![](https://img.aspxhome.com/file/2023/7/56187_0s.gif)
在python 不同时区之间的差值与转换方法
2023-10-15 12:20:57
Oracle 安装和卸载问题收集(集合篇)第1/6页
2009-07-02 12:20:00