importTrackMateTracks: a MATLAB script to import TrackMate track files.

From the file help:

importTrackMateTracks Import linear tracks from TrackMate

  This function reads a XML file that contains linear tracks generated by
  TrackMate (http://fiji.sc/TrackMate). Careful: it does not open the XML
  TrackMate session file, but the track file exported in TrackMate using
  the action 'Export tracks to XML file'. This file format contains less
  information than the whole session file, but is enough for linear tracks
  (tracks that do not branch nor fuse).

  SYNTAX

  tracks = importTrackMateTracks(file) opens the track file 'file' and
  returns the tracks in the variable 'tracks'. 'tracks' is a cell array,
  one cell per track. Each cell is made of 4xN double array, where N is the
  number of spots in the track. The double array is organized as follow:
  [ Ti, Xi, Yi, Zi ; ...] where T is the index of the frame the spot has been
  detected in. T is always an integer. X, Y, Z are the spot spatial
  coordinates in physical units.

  [tracks, metadata] = importTrackMateTracks(file) also returns 'metadata',
  a struct that contains the metadata that could be retrieved from the XML
  file. It is made of the following fields:
    - 'spaceUnits': a string containing the name of the physical spatial unit.
    - 'timeUnits': a string containing the name of the physical temporal unit.
    - 'frameInterval': a double whose value is the frame interval.
    - 'date': a string representation of the date the XML file has been generated.
    - 'source': a string representation of the TrackMate version this file
      has been generated with.

  OUTPUT

  The function offers two flags to change how the output is returned. As
  stated above, by default, it is returned as [ Ti, Xi, Yi, Zi ; ...] where
  T is the frame as an integer.

   tracks = importTrackMateTracks(file, clipZ) allows specifying whether to
   remove the Z coordinate entirely or not. TrackMate always return 3D
   coordinates, even for 2D motion. In the latter case, the Z coordinate is
   always 0. If 'clipZ' is set to true AND if all the particles have their
   Z coordinate to 0, then 'tracks' will be made of [ Ti, Xi, Yi ] arrays.

   tracks = importTrackMateTracks(file, clipZ, scaleT) allows specifying
   whether to scale the T coordinate by physical units. If scaleT is set to
   true AND if the frame interval metadata value could be retrieved, then
   the time will be returned in physical units, not in integer frame
   number.

  FILE FORMAT

  The XML file is expected to be formatted as follow:

  <?xml version="1.0" encoding="UTF-8"?>
  <Tracks nTracks="39" spaceUnits="pixel" frameInterval="5.0" timeUnits="s" generationDateTime="Thu, 8 Aug 2013 13:33:23" from="TrackMate v2.1.0">
    <particle nSpots="125">
        <detection t="0" x="69.3" y="151.0" z="0.0" />
        <detection t="1" x="70.0" y="153.0" z="0.0" />
            ... etc...
    </particle>
    <particle nSpots="99">
        ...
    </particle>
    ...
  </Tracks>

  Jean-Yves Tinevez <jeanyves.tinevez@gmail.com> - 2013

Signed-off-by: Jean-Yves Tinevez <jean-yves.tinevez@pasteur.fr>

[CTR: Cherry-picked from https://github.com/fiji/fiji/commit/2aad1dcb]
Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>