Skip to contents

Given the path of the .mat file corresponding to Ctrax 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).

  • 'angle': the particle's absolute angle in radians, orientation of the particle according to y-axis.

  • 'min.ax': the length of the minor axis for a particle over frame (i.e., width of the ellipse).

  • '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

readCtrax(ctraxPath, flipY = FALSE, imgHeight = NULL)

Arguments

ctraxPath

The full path of the Ctrax output file (.mat).

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 top-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 bottom-left.

References

Branson, K., Robie, A., Bender, J. et al. High-throughput ethomics in large groups of Drosophila. Nat Methods 6, 451–457 (2009). https://doi.org/10.1038/nmeth.1328. Ctrax: The Caltech Multiple Walking Fly Tracker

Author

Quentin PETITJEAN, Vincent CALCAGNO

Examples

if (FALSE) {

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

# Import the data as an object of class "tracklets"
# and do not flip Y coordinates (start on the bottom-left)
Data <- MoveR::readCtrax(Path2Data[[1]])
str(Data)

}