
Reparametrize a streamline or bundle onto a uniform arc-length grid
Source:R/parametrize.R
reparametrize.Rdreparametrize() is an S7 generic that resamples the 3-D coordinates (and
any numeric @point_data attributes) of a tractography object onto a
uniform arc-length grid using linear interpolation, with methods available
for the following classes:
Arguments
- x
A streamline or bundle object.
- n_points
Number of equally-spaced arc-length points to use.
For a single streamline, defaults to
x@n_points.For a bundle, defaults to the rounded mean number of points across all streamlines.
Pass
NULLto use these defaults explicitly.
Examples
# reparametrize a single streamline to 10 points
sl <- streamline(points = cbind(X = runif(5), Y = runif(5), Z = runif(5)))
sl_reparam <- reparametrize(sl, n_points = 10)
# reparametrize a bundle to the mean number of points across its streamlines
sl1 <- streamline(points = cbind(X = runif(5), Y = runif(5), Z = runif(5)))
sl2 <- streamline(points = cbind(X = runif(10), Y = runif(10), Z = runif(10)))
b <- bundle(streamlines = list(sl1, sl2))
bundle_reparam <- reparametrize(b)