In my previous note we implemented the DBSCAN clustering algorithm. In this note, we use DBSCAN for image segmentation. I came across the image segmentation problem from 3D embryo imaging, which few of my colleagues were working on. I wanted to see if I could adapt the DBSCAN algorithm to this problem, which is demonstrated below. Move your cursor over the image on the right.

Even though the above demonstration uses 2D embryo section image, the algorithm is applicable to 3D voxels. All we need to change is the way the epsilon neighbours are selected. For the 2D image, there are eight adjacent pixel neighbours; whereas, a 3D voxel has 26 adjacent voxel neighbours. The rest of the algorithm need not change.

I am really interested in figuring out a way to understand the relationship between the clustering parameters (epsilon and minpts) and the generated clusters. There are cluster metrics such as silhouettes that I could explore. I think this is an interesting optimisation problem, where the aim is to find the parameters that will give us clusters with the highest coverage, with minimum within-cluster pixel/voxel intensity variance. Perhaps, when I have some time I might work on this again.

## Source code

A printable version of this DBSCAN note is available here. You can download the source code for C and JavaScript at:

git clone https://github.com/gyaikhom/dbscan.git

The modified code for image segmentation was implemented in JavaScript, and resides in the `imageseg`

directory.