Python による生体医療画像解析
Stephen Bailey
Instructor
駆出率: 心臓の左心室 (LV) から拍出される血液の割合。



import scipy.ndimage as ndi im=imageio.imread('SCD4201-2d.dcm') filt=ndi.gaussian_filter(im, sigma=2) mask = filt > 150labels, nlabels = ndi.label(mask)
nlabels
14
plt.imshow(labels, cmap='rainbow')
plt.axis('off')
plt.show()

画像内の単一ラベルを選択する:
np.where(labels == 1, im, 0)
画像内の複数ラベルを選択する:
np.where(labels < 3, im, 0)
バウンディングボックス: オブジェクトを完全に囲むピクセルの範囲
ndi.find_objects() はバウンディングボックス座標のリストを返す

labels, nlabels = ndi.label(mask) boxes = ndi.find_objects(labels)boxes[0]
(slice(116,139), slice(120, 141))

Python による生体医療画像解析