As part of an extracurricular project, I designed a MATLAB script to located the ventricles of the brain in MRI images. For the sake of simplicity, let’s assume an MRI image can be broken down into four categories in terms of voxel data:
- White matter (WM)
- Grey matter (GM)
- Cerebrospinal fluid (CSF)
- Non-tissue (ie: areas outside of the skull)
Initially, the non-tissue portion of the image is calculated by comparing the eight corners of the 3D image, and carrying out a seed/flood fill algorithm on it to uniquely identify the 26-neighbor connected region outside the region of interest. Then, a k-means segmentation algorithm is applied to the remaining pixels, separating them into three distinct groups.
The result is the voxels in the MRI 3D image being successfully separated into four separate groups. We know which one is the non-tissue group, but we have no immediate way of knowing how to determine which groups are WM, GM, and CSF voxels. Falling back to my knowledge of statistics, I realized that if we calculate the centroid of the 3D object consisting of WM, GM, and CSF pixels, the mean and variance for their spatial distribution will be quite unique for each group. I’d expect the ventricles (CSF) to have a small mean volume, and be near the center, while the other groups would have a mean position around the centroid with increased variance.
Based on this assumption, statistical analysis is carried out for each group to determine the volume, centroid, and spatial variance for each group, then labelling each group according to the metrics which are the closest expected match for the appropriate tissue type. The end result is an algorithm which consistently identifies all four groups accurately, even when the images haven’t been normalized or aligned properly.
Finally, principle component analysis is carried out on the voxels that comprise each ventricle so that the principal axes can be determined, and by extension, we know the orientation of each ventricle, and can determine if there are any abnormalities with respect to the size, shape, and orientation of the ventricles (ie: physical trauma).