Skip to contents

Given an object of class "tracklets" containing a list of tracklets, this function returns a list of vector containing the result of a user defined condition test for each tracklet.

Usage

filterFunc(trackDat, toFilter = NULL, customFunc = NULL)

Arguments

trackDat

An object of class "tracklets" containing a list of tracklets and their characteristics classically used for further computations (at least x.pos, y.pos, frame).

toFilter

An element of the tracklet's data frame (a column name) from which condition will be verified.

customFunc

A custom function containing condition(s) to be applied to toFilter argument.

Value

A list of vector of the same length than the tracklets object containing the result of a user specified condition test for each tracklet.

See also

Author

Quentin PETITJEAN

Examples

if (FALSE) {

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

# Import the list containing the 9 vectors classically used for further computation
trackDat <- MoveR::readTrex(Path2Data[[1]])

# example 1: test for the presence of infinite value in x.pos, if infinite values are detected, the result is TRUE 
CondTest1 <- MoveR::filterFunc(trackDat, toFilter = "x.pos", customFunc = function(x) is.infinite(x))
str(CondTest1)

# example 2: test for the length of the particles, if particles size is ranging between 1 and 20 pixels, the result is TRUE 
CondTest2 <- MoveR::filterFunc(trackDat, toFilter = "maj.ax", customFunc = function(x) x >= 1 & x <= 20)
str(CondTest1)

}