AllenInstitute / ophys_etl_pipelines

Pipelines and modules for processing optical physiology data
Other
9 stars 5 forks source link

Develop prototype ROI merging code based on Louvain clustering #276

Closed danielsf closed 2 years ago

danielsf commented 3 years ago

The Louvain clustering algorithm is a well-established algorithm for finding communities in a graph network. It is a central part of the algorithm used by the RNASeq scientists for discovering cell types. The relevant part of the cell cluster finding algorithm is (this is copy-and-pasted from a summary @danielsf wrote for himself after reading Tasic et al. 2018)

For each pixel find the 15 nearest neighbors in PCA space. These 15 cells define the neighborhood for each pixel To find the weight of the edge between pixels A and B, use the intersection over union of A and B's neighborhood. Use these neighborhoods as the seed communities for the Louvain cluster finding algorithm.

This ticket represents work to experiment with using the Louvain clustering algorithm to solve the ROI merging problem. If it works well, we can consider using the algorithm to find ROIs in the first place.

Tasks

Stretch task

Validation

danielsf commented 3 years ago

I suspect this is not actually going to get closed this sprint (9/10), so I wanted to post an update.

I do have a prototype implementation in this branch https://github.com/AllenInstitute/ophys_etl_pipelines/tree/segmentation/dev/louvain/clustering

It appears to work well on experiments that clearly need merging, see, for example

experiment 795901850 795901850_merger_results.png

experiment 850517348 850517348_merger_results.png

However, in cases that do not obviously need merging, it seems to merge over-enthusiastically, sometimes with egregious results. See the upper-left corner of

experiment 785569447 785569447_by_hand_ancestors.png

I have some ideas how we can amend this behavior, namely

These are largely speculative and will require some numerical experiments to evaluate.