測量形態學

Python 的生醫影像分析

Stephen Bailey

Instructor

形態學

由 Keating, Steven. (2014) - Keating, Steven. (2014). 2007 與 2014 年星形細胞瘤病患的腦部 MRI 橫切片。Zenodo。doi:10.5281/zenodo.16852,CC0,https://commons.wikimedia.org/w/index.php?curid=39593095

Python 的生醫影像分析

空間範圍

空間範圍 為下列兩者的乘積:

  1. 每個元素所占空間
  2. 陣列元素數量

heart-3d-image

# Calculate volume per voxel
d0, d1, d2 = vol.meta['sampling']
dvoxel = d0 * d1 * d2

# Count label voxels nvoxels=ndi.sum(1, label, index=1)
# Calculate volume of label volume = nvoxels * dvoxel volume
1249023
Python 的生醫影像分析

距離轉換

distance-overlay-on-original

          歐幾里得距離

# Create a left ventricle mask
mask=np.where(labels == 1, 1, 0)
# In terms of voxels
d=ndi.distance_transform_edt(mask)

d.max()
12.3847
# In terms of space
d=ndi.distance_transform_edt(mask,
    sampling=vol.meta['sampling'])
d.max()
5.8038
Python 的生醫影像分析

質心(Center of Mass)

com=ndi.center_of_mass(vol,
                       labels, 
                       index=1)

com
(5.5235, 128.0590, 128.0993)
plt.imshow(vol[5], cmap='gray')
plt.scatter(com[2], com[1])
plt.show()

質心

Python 的生醫影像分析

一起來練習吧!

Python 的生醫影像分析

Preparing Video For Download...