vanvalenlab / deepcell-tracking

Track cells and build cell lineages
Other
29 stars 6 forks source link

Improve error handling for `relabel_sequential_lineage` and `is_valid_lineage` #73

Closed willgraf closed 3 years ago

willgraf commented 3 years ago

is_valid_lineage only checks the lineage object itself. However, the lineage object is completely dependent on the y label mask. This function has been changed to require the y array, and is a much stronger validation of lineages. (Closes #72) This PR changes the is_valid_lineage signature, and should be considered a breaking change.

Additionally, relabel_sequential has been found to map unknown integers to 0. This caused some confusion that the original .trk file had a 0 as a daughter value. When this happens, relabel_sequential_lineage will warn the user that the value is getting mapped to 0. This will only happen with invalid lineages.

Finally, the Track object has been updated to only call relabel_sequential_lineage if the lineage is found to be valid. This should help reduce instantiation time by skipping the relabel step for invalid batches.