Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate parent lineage field as well as daughters. #76

Merged
merged 2 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions deepcell_tracking/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,27 @@ def is_valid_lineage(y, lineage):
cell_label, daughter))
return False

# TODO: test parent in lineage
parent = cell_lineage.get('parent')
if parent:
try:
parent_lineage = lineage[parent]
except KeyError:
warnings.warn('Parent {} is not present in the lineage'.format(
cell_lineage['parent']))
return False
try:
last_parent_frame = parent_lineage['frames'][-1]
first_daughter_frame = cell_lineage['frames'][0]
except IndexError: # frames is empty?
warnings.warn('Cell {} has no frames'.format(parent))
return False
# Check that daughter's start frame is one larger than parent end frame
if first_daughter_frame - last_parent_frame != 1:
warnings.warn('lineage {} has daughter {} before parent.'.format(
cell_label, daughter))
return False

return True # all cell lineages are valid!


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
readme = f.read()


VERSION = '0.5.0-rc.1'
VERSION = '0.5.0-rc.2'
NAME = 'DeepCell_Tracking'
DESCRIPTION = 'Tracking cells and lineage with deep learning.'
LICENSE = 'LICENSE'
Expand Down