欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Python下对DICOM图像的读取研究

程序员文章站 2022-03-31 20:48:48
...

import dicom
import json
import  os
def loadFileInformation(filename):
    information = {}
    ds = dicom.read_file(filename)
    information['w'] = ds.Rows
    information['h'] = ds.Columns
    information['type'] = ds.Modality
    information['PatientBirthDate'] = ds.PatientBirthDate
    information['PatientSex'] = ds.PatientSex
    information['StudyID'] = ds.StudyID
    information['StudyDate'] = ds.StudyDate
    information['StudyTime'] = ds.StudyTime
    information['SOP Instance UID '] = ds.SOPInstanceUID
    information['Manufacturer'] = ds.Manufacturer
    print (dir(ds))
    print (type(information))
    return information
path = "E:\\image\\xxx.dcm"
a=loadFileInformation(path)
print (a)