rotate_trajectory: Rotate trajectories

Description Usage Arguments Examples

Description

Rotates all trajectories 'en bloc' using the centre of the image as origin.

Usage

1
rotate_trajectory(object, angle)

Arguments

object

An object of class 'Traj'

angle

A numeric value corresponding to the desired angle of rotation. If positive, trajectories are rotated clockwise. If negative, they are rotated counterclockwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Upload image and trajectories
data(cellmask)
data(trajectory)

rotatedtraj <- rotate_trajectory(trajectory, 90)
## Display image (first frame only)
EBImage::display(cellmask, method = "raster")

## Overlay trajectories in black
ntraj = nlevels(trajectory["trajectory"])
for (i in 1:ntraj) {
traj_i <- subset(trajectory["data"], trajectory == i)
lines(traj_i$x, traj_i$y, type="l", col = "black")
}
## Overlay rotated trajectories in blue
nrotatedtraj = nlevels(rotatedtraj["trajectory"])
for (i in 1:nrotatedtraj) {
traj_i <- subset(rotatedtraj["data"], trajectory == i)
lines(traj_i$x, traj_i$y, type="l", col = "blue")
}

MaxLev/CloseEnough documentation built on May 9, 2019, 2:19 a.m.