Python SimpleITK笔记

修改itk::GDCMImageIO类,支持带中文路径的Dicom图像读写
http://blog.163.com/jacky_ling0/blog/static/1373925712012441185643/
SimpleITK暂时不支持中文目录,用处不大
还是推荐使用pydicom
# -*- coding: GBK -*-

import SimpleITK as sitk
import numpy as np
import sys,os

case_path = r"C:\Users\BNC\Desktop\P101044"
# print(os.path.exists(case_path))

print(case_path)
reader = sitk.ImageSeriesReader()
dicom_names = reader.GetGDCMSeriesFileNames(case_path)
reader.SetFileNames(dicom_names)
image = reader.Execute()
image_array = sitk.GetArrayFromImage(image) # z, y, x
origin = image.GetOrigin() # x, y, z
spacing = image.GetSpacing() # x, y, z


print(dicom_names)


发表于:2018-05-25 15:22:45

原文链接(转载请保留): http://www.multisilicon.com/blog/a25332576.html

友情链接: MICROIC
首页