[医学影像数据处理] dicom 转 nii

1. 可直接安装dicom2nifti

2. 或者

dicom_path = 'dddddd'
file_list = os.listdir(dicom_path)
data_array = []
local_list = []
for file_name in file_list:
    dicom_name = os.path.join(dicom_path,file_name)
    ds = pydicom.read_file(dicom_name, stop_before_pixels=False)
    local_list.append(ds.SliceLocation)
    data_array.append(ds.pixel_array)

    data_array = np.array(data_array[np.array(local_list).argsort()])
                    
    data_itk = itk.GetImageFromArray(data_array)
    save_name = 'ccccccc'
    itk.WriteImage(data_itk,save_name)

你可能感兴趣的:(图像处理,图像处理)