Skip to content

TrackArray spec

Jian Tay edited this page Apr 11, 2020 · 1 revision

Glossary

  • Tracks represent the data connected to individual objects across every frame of the timelapse video.

  • Track ID is a unique identifier (number) that is assigned to a track when it is created. For most functions, this is the identifier that should be used to refer to a track.

  • Track index is the index of the track within the data structure. In other words, it is the index that MATLAB would use to refer to the location in the struct array.

    Note that for the most part, track IDs and track indices will be the same. However, if a track was deleted for any reason, these values will diverge.

Track data structure

Tracks are stored as a structured array (struct) in the property Tracks.

The Tracks struct has the following fields:

  • ID: Unique, cannot be changed
  • MotherID: ID of mother track
  • DaughterID: ID of daughter tracks
  • Frames: Vector of frame numbers (sorted), cannot be changed by user
  • Data: A struct containing experimental data. Each field is stored as a cell array, with a single cell per frame.

Timeseries data

Timeseries data is stored as a subarray in the Data field. The fieldnames in Data is obtained from the input struct to LAPLinker. We will use the following example:

%Example of a possible input data structure
dataIn.LineLength = 10;

%Create a new LAPLinker object and assign the track
L = LAPLinker;
L = assignToTrack(L, 1, dataIn);

%Extract the track array
TA = L.tracks;

By design, there are two ways to retrieve tracked data.

Directly accessing track data

If accessing the data directly, the timeseries data is stored as a cell array to handle the possibility of differently sized data (e.g. PixelIdxList form regionprops).

Probing the track data will give

>> TA(1).Tracks.Data
ans = 
  struct with fields:

    LineLength: {[10]}

Using getTrack

You can also use the getTrack method to get the data returned as a struct:

>> T = getTrack(TA, 1)
T = 
  struct with fields:

            ID: 1
      MotherID: NaN
    DaughterID: NaN
        Frames: 1
    LineLength: 10

Here the timeseries data will be combined with the rest of the track metadata. If each entry in the field has the same size, it will be combined into a single matrix.

  • Track data is stored in cells, where each cell corresponds to the data from a single frame. For example, the following shows a valid example: obj.Tracks(1).Frames = [1 3 4 5]; obj.Tracks(1).Data.Length = {10, 32, 35, 45}; obj.Tracks(1).Data.PxIndexList = {[1, 5, 3], [2, 4], [1]};

    If data for a tracked property is not available for a single frame, it should be represented by an empty matrix: obj.Tracks(1).Data.NumSpots = {2, [], 5};