% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parametrize.R
\name{reparametrize}
\alias{reparametrize}
\title{Reparametrize a streamline or bundle onto a uniform arc-length grid}
\usage{
reparametrize(x, n_points = NULL)
}
\arguments{
\item{x}{A \link{streamline} or \link{bundle} object.}

\item{n_points}{Number of equally-spaced arc-length points to use.
\itemize{
\item For a single \link{streamline}, defaults to \code{nrow(x@points)}.
\item For a \link{bundle}, defaults to the rounded mean number of points across
all streamlines.
}

Pass \code{NULL} to use these defaults explicitly.}
}
\value{
An object of the same class as \code{x} reparametrized onto the new
grid.
}
\description{
\code{reparametrize()} is an S7 generic that resamples the 3-D coordinates (and
any \verb{@point_data} attributes) of a tractography object onto a uniform
arc-length grid using linear interpolation, with methods available for the
following classes:

\itemize{
\item \code{\link[=reparametrize-fiber-bundle-method]{fiber::bundle}}
\item \code{\link[=reparametrize-fiber-streamline-method]{fiber::streamline}}
}
}
\examples{
# reparametrize a single streamline to 10 points
pts <- matrix(runif(30), ncol = 3)
colnames(pts) <- c("X", "Y", "Z")
sl <- streamline(points = pts)
sl_reparam <- reparametrize(sl, n_points = 10)
# reparametrize a bundle to the mean number of points across its streamlines
sl1 <- streamline(points = pts)
pts2 <- matrix(runif(60), ncol = 3)
colnames(pts2) <- c("X", "Y", "Z")
sl2 <- streamline(points = pts2)
b <- bundle(streamlines = list(sl1, sl2))
bundle_reparam <- reparametrize(b)
}
