1 、NII格式
代码:
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 30 22:39:31 2019
@author: txx
"""
import nibabel as nib
import matplotlib.pyplot as plt
def read_data(path):
image_data = nib.load(path).get_data()
return image_data
def show_img(ori_img):
plt.imshow(ori_img, cmap = 'gray') #channel_last
plt.show()
path = 'F:/data/ACDC/training/patient001/patient001_4d.nii'
data = read_data(path)
show_img(data[:,:,4,4])
aa=data[:,:,4,4]
结果:
2 .MAT格式
数据链接:https://github.com/peng-cao/mripy/tree/master/data
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
path&#