Processing bemovi output
If you did not carry on with the analysis, re-load the necessary packages and paths:
library(bemovi) library(randomForest) library(data.table) library(ggplot2) # project directory (you create this one yourself) to.data <- "/Users/Frank//Bemovi demo/" # you also have to provide two folders: # the first contains the video description # the second holds the raw videos video.description.folder <- "0 - video description/" video.description.file <- "video.description.txt" raw.video.folder <- "1 - raw/" # the following intermediate directories are automatically created particle.data.folder <- "2 - particle data/" trajectory.data.folder <- "3 - trajectory data/" temp.overlay.folder <- "4a - temp overlays/" overlay.folder <- "4 - overlays/" merged.data.folder <- "5 - merged data/" ijmacs.folder <- "ijmacs/" # video frame rate (in frames per second) fps <- 25 # size of a pixel in micrometer pixel_to_scale <- 1000/240
For further processing in R, the data has to be loaded from the merged database (Master.RData), which is placed in the merged.data.folder.
The data is saved under the name trajectory.data as a data.table, for efficient processing of the usually large tables (more than 1,000,000 rows).
Although the video segmentation should be fine-tuned to yield the highest signal-to-noise ratio, a fraction of the identified trajectories may still be artefactual trajectories. To remove these, the filter_data() function selects trajectories based on the minimum net displacement, their duration, the detection frequency and the median step length.
trajectory.data.filtered <- filter_data(trajectory.data,50,1,0.1,5) trajectory.data.filtered$type <- "filtered data" trajectory.data$type <- "raw data"
The following figure shows the effect of the filtering.