Description Usage Arguments Examples
Rotates all trajectories 'en bloc' using the centre of the image as origin.
1 | rotate_trajectory(object, angle)
|
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. |
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")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.