% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coerce.R
\name{as_bundle}
\alias{as_bundle}
\title{Coerce an object to a bundle}
\usage{
as_bundle(x, ...)
}
\arguments{
\item{x}{An object to coerce.}

\item{...}{Additional arguments (currently unused).}
}
\value{
A \link{bundle} object.
}
\description{
\code{as_bundle()} converts a supported object into a \link{bundle}.
}
\details{
Currently supported input classes:
\itemize{
\item \link{streamline}: wrapped in a single-element \link{bundle} (lossless).
\item \link{bundle}: returned unchanged.
\item \code{dwiFiber} (from \pkg{dti}): each fiber becomes a \link{streamline}. The
per-point direction vectors (columns 4–6 of \verb{@fibers}) are stored as
\verb{@point_data$direction_x}, \verb{@point_data$direction_y}, and
\verb{@point_data$direction_z}. Tracking metadata (\code{method}, \code{minfa},
\code{maxangle}) are stored in \verb{@bundle_data}.
}
}
\examples{
pts <- matrix(runif(15), ncol = 3, dimnames = list(NULL, c("X", "Y", "Z")))
sl <- streamline(points = pts)
b  <- as_bundle(sl)
b@n_streamlines  # 1
}
\seealso{
\code{\link[=as_streamline]{as_streamline()}}, \code{\link[=as_dwifiber]{as_dwifiber()}}
}
