Skip to contents

Given the path of the .npy file corresponding to idtracker output, this function returns an object of class "tracklets", a list of tracklets (data frame) containing 7 elements classically used for further computations using MoveR package:

  • 'maj.ax': the length of the major axis (i.e., the midline) for a particle over frame (i.e., length of the ellipse), returns NA since it is not present in the Idtracker output.

  • 'angle': the particle's absolute angle in radians, orientation of the particle according to y-axis, returns NA since it is not present in the Idtracker output.

  • 'min.ax': the length of the minor axis for a particle over frame (i.e., width of the ellipse), returns NA since it is not present in the Idtracker output.

  • 'x.pos': x position of the particle's centroid.

  • 'y.pos': y position of the particle's centroid.

  • 'identity': the particle's identity given by the tracking software.

  • 'frame': the video frame number at which the measurements has been made.

Also, the function can flip y coordinates (see flipY argument).

Usage

readIdtracker(IdtrackerPath, flipY = FALSE, imgHeight = NULL)

Arguments

IdtrackerPath

The full path of the idtrackerai output file (.npy).

flipY

A logical value (i.e., TRUE or FALSE) indicating whether the origin of y coordinates should be flipped. If TRUE, y coordinates are flipped to start on the bottom-left (default = FALSE).

imgHeight

A numeric value expressed in pixels, the length of Y axis corresponding to the height of the image or video resolution (optional, only used when flipY = TRUE).

Value

An object of class "tracklets" containing a list of tracklets and their characteristics classically used for further computations. Also, by default the function returns y coordinates starting on the top-left.

References

Romero-Ferrero, F., Bergomi, M.G., Hinz, R.C. et al. idtracker.ai: tracking all individuals in small or large collectives of unmarked animals. Nat Methods 16, 179–182 (2019). https://doi.org/10.1038/s41592-018-0295-5. idtracker.ai

Author

Quentin PETITJEAN

Examples

if (FALSE) {

# Download the first dataset from the sample data repository
Path2Data <- MoveR::DLsampleData(dataSet = 1, tracker = "IdTracker")
Path2Data

# Import the list containing the 9 vectors classically used for further computation
# and flip Y coordinates to start on the bottom-left
Data <-
  MoveR::readIdtracker(Path2Data[[1]],
         flipY = T,
         imgHeight = 2160
  )
str(Data)

}