tobac
tobac copied to clipboard
Add overlap tracking
After discussion at the workshop, I think we should go ahead and add overlap tracking using the segmentation output. We should probably do this post-xarray switchover, but I wanted to add it to our issues list so that we can plan around it.
Would the easiest way to implement this be to specify a structure with scipy.ndimage.label
that connects segmented features that are continuous over the time dimension or would you rather write our own method (e.g. by checking if segmented features within the predicted search radius share a certain area between two time steps)? What other methods exist already in python that define the intersection/overlap between two objects?
I've looked into using scipy.ndimage.label
for this before, and although I don't think we can use it directly (as it would overwrite the segmentation step), we can use a similar approach.
I have some code that already implements this in tobac-flow
, that could be be simplified for a more general case (see below). We could add more options for minimum/maximum overlap and predictive tracking in the find_neighbour_labels
function fairly easily. It also currently combines all merging/splitting features, but this could also be changed to only accept the largest overlap
https://github.com/w-k-jones/tobac-flow/blob/7fab315573279cb95a40632ef7034eb8c568aa40/src/tobac_flow/label.py#L233-L394
I've started work on adding overlap tracking in https://github.com/w-k-jones/tobac/tree/overlap_tracking, with a basic working version. There are still a number of features that need adding/improving, but I'll open a draft pull request before it gets to a point where it's too complicated to review