用python 遍历文件夹中所有.dcm文件


import dicom
import os


def eachFile(filepath):
for file in os.listdir(filepath):
child = os.path.join(filepath, file)
if(os.path.isdir(child)):
eachFile(child)
else:
if os.path.splitext(child)[1] == ".dcm":
# print(child)
ds = dicom.read_file(child)
print(ds.UID)
posted @ 2018-01-04 18:03  路在脚下丶  阅读(1466)  评论(0编辑  收藏  举报