diff --git a/yeast_lab/source/java/ch/ethz/bsse/cisd/yeastlab/GenerationDetection.java b/yeast_lab/source/java/ch/ethz/bsse/cisd/yeastlab/GenerationDetection.java index a5247e8d5ea898bff40e0ed98738f86cc70839ec..0cb9162eead6cdf21ba8a19a0408564e20396fa2 100644 --- a/yeast_lab/source/java/ch/ethz/bsse/cisd/yeastlab/GenerationDetection.java +++ b/yeast_lab/source/java/ch/ethz/bsse/cisd/yeastlab/GenerationDetection.java @@ -398,15 +398,27 @@ public class GenerationDetection private static class ParentCandidate implements Comparable<ParentCandidate> { + @SuppressWarnings("unused") + private final Cell previousFrameParent; + + /** + * parent cell from the same frame that the child appeared on or from the previous frame if + * parent disappeared just after division + */ private final Cell parent; private final Cell child; private final Integer distanceSq; - public ParentCandidate(Cell parent, Cell child) + public ParentCandidate(Cell previousFrameParent, Cell child) { - this.parent = parent; + this.previousFrameParent = previousFrameParent; + // on the frame that child appeared parent could disappear (5 cases in test data) + final Cell childFrameParentOrNull = + cellsByIdAndFrame.get(previousFrameParent.id).get(child.frame); + this.parent = + (childFrameParentOrNull != null) ? childFrameParentOrNull : previousFrameParent; this.child = child; this.distanceSq = distanceSq(parent, child); }