Skip to content
Snippets Groups Projects
Select Git revision
  • e5f87633107f181fdeef6323b894ab8ac806cd4d
  • master default protected
  • archive
  • v7.14.3
  • v7.14.2
  • v7.14.1
  • v7.14
  • v7.13
  • v7.12
  • v7.11
  • v7.10
  • v7.9
  • v7.8
  • v7.7
  • v7.6
  • v7.5
  • v7.4
  • v7.3
  • v7.3_MultiCellType
  • v7.2
  • v7.2_MultiCell
  • v7.1
  • v7.1_MultiCell
23 results

AddHullToTrack.m

Blame
  • AddHullToTrack.m 2.04 KiB
    function AddHullToTrack(hullID,trackID,previousHullID)
    % function AddHullToTrack(hullID,trackID,previousHullID)
    %The hullID will be added to the track
    %
    %If trackID is given, previousHullID is not used.  Safe to
    %send [] for either trackID or previousHullID.
    %Prereq to leave trackID empty - Track to be added to exists and the
    %previousHullID exists in that track.  Also, it has been
    %removed from any previous track assosiation.
    
    %--Eric Wait
    
    global HashedCells CellTracks CellFamilies CellHulls
    
    if(isempty(trackID))
        %find the track to add this hull to
        previousTime = CellHulls(previousHullID).time;
        index = find([HashedCells{previousTime}(:).hullID]==previousHullID);
        if(isempty(index))
            error('Previous CellHull -- %d not found!',previousHullID);
        end
        %add the hullID to track
        curTrackID = HashedCells{previousTime}(index).trackID;
    else
        curTrackID = trackID;
    end
    
    time = CellHulls(hullID).time;
    hash = time - CellTracks(curTrackID).startTime + 1;
    if(0 >= hash)
        RehashCellTracks(curTrackID, time);
        CellTracks(curTrackID).startTime = time;
        hash = time - CellTracks(curTrackID).startTime + 1;
        if(CellFamilies(CellTracks(curTrackID).familyID).startTime > time)
            CellFamilies(CellTracks(curTrackID).familyID).startTime = time;
            %TODO: Check if any sibling and change mitosis
            %TODO: Check if this changes the root of the family
        end
    end
    CellTracks(curTrackID).hulls(hash) = hullID;
    
    if(CellTracks(curTrackID).endTime < time)
        CellTracks(curTrackID).endTime = time;
        if(CellFamilies(CellTracks(curTrackID).familyID).endTime < time)
            CellFamilies(CellTracks(curTrackID).familyID).endTime = time;
        end
        %TODO: Check if any sibling where this might contradict
    elseif(CellTracks(curTrackID).startTime > time)
        CellTracks(curTrackID).startTime = time;
        if(CellFamilies(CellTracks(curTrackID).familyID).startTime > time)
            CellFamilies(CellTracks(curTrackID).familyID).startTime = time;
        end
    end
    
    %add the trackID back to HashedHulls
    AddHashedCell(time,hullID,curTrackID);
    
    end