Measuring morphology

Biomedical Image Analysis in Python

Stephen Bailey

Instructor

Morphology

By Keating, Steven. (2014) - Keating, Steven. (2014). MRI cranial slices of astrocytoma patient in 2007 and 2014. Zenodo. doi:10.5281/zenodo.16852, CC0, https://commons.wikimedia.org/w/index.php?curid=39593095

Biomedical Image Analysis in Python

Spatial extent

Spatial extent is the product of:

  1. Space occupied by each element
  2. Number of array elements

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
Biomedical Image Analysis in Python

Distance transformation

distance-overlay-on-original

          Euclidean Distance

# 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
Biomedical Image Analysis in 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()

center-of-mass

Biomedical Image Analysis in Python

Let's practice!

Biomedical Image Analysis in Python

Preparing Video For Download...