Overlap track avoid split

overlap
trackobjects

#1

Hi,

I am running a pipeline for tracking yeast cells through time. The segmentation works nicely separating neighboring single cells. The segmentation was done separately in ilastik. In the end I would like to quantify fluoresence intensity through time in each individual cell.

However, the issue that I run into is that when the cells bud, the tracking algorithm (overlap based) in 80% of the time assigns the same label of the mother cell to that of the daughter cell, eventhough the objects are separated. Other than this minor issue everything else works nicely.

I understand that the LAP method is there to be more flexible, however I could not optimize it and I suspect that one issue might be that this algorithm assumes symmetrical division of the cells (like Ecoli) however the cell division in my yeast cells are very asymmetrical as it is budding rather than cell division.

I imagine it should be rather straight forward to tweak the code (trackobjects.py module) so that split events would never happen. I am wondering if you could advise me on this matter.

I suspect something in the following chunk of code in from the trackobjects.py module should be edited. If you only point me to the right direction, line or variable it would be very appreciated.

Thank you very much.

I have attached my project file as well.

def run_overlap(self, workspace, objects):
    '''Track objects by maximum # of overlapping pixels'''
    current_labels = objects.segmented
    old_labels = self.get_saved_labels(workspace)
    i, j = (centers_of_labels(objects.segmented) + .5).astype(int)
    if old_labels is None:
        count = len(i)
        self.map_objects(workspace, np.zeros((0,), int),
                         np.zeros(count, int), i, j)
    else:
        mask = ((current_labels > 0) & (old_labels > 0))
        cur_count = np.max(current_labels)
        old_count = np.max(old_labels)
        count = np.sum(mask)
        if count == 0:
            # There's no overlap.
            self.map_objects(workspace,
                             np.zeros(old_count, int),
                             np.zeros(cur_count, int),
                             i, j)
        else:
            cur = current_labels[mask]
            old = old_labels[mask]
            histogram = scipy.sparse.coo_matrix(
                    (np.ones(count), (cur, old)),
                    shape=(cur_count + 1, old_count + 1)).toarray()
            old_of_new = np.argmax(histogram, 1)[1:]
            new_of_old = np.argmax(histogram, 0)[1:]
            #
            # The cast here seems to be needed to make scipy.ndimage.sum
            # work. See http://projects.scipy.org/numpy/ticket/1012
            #
            old_of_new = np.array(old_of_new, np.int16)
            old_of_new = np.array(old_of_new, np.int32)
            new_of_old = np.array(new_of_old, np.int16)
            new_of_old = np.array(new_of_old, np.int32)
            self.map_objects(workspace,
                             new_of_old,
                             old_of_new,
                             i, j)
    self.set_saved_labels(workspace, current_labels)

170323_fluo_ilas_seg_v4.cpproj (5.1 MB)