Skip to contents

as_bundle() converts a supported object into a bundle.

Usage

as_bundle(x, ...)

Arguments

x

An object to coerce.

...

Additional arguments (currently unused).

Value

A bundle object.

Details

Currently supported input classes:

  • streamline: wrapped in a single-element bundle (lossless).

  • bundle: returned unchanged.

  • dwiFiber (from dti): each fiber becomes a streamline. The per-point direction vectors (columns 4–6 of @fibers) are stored as @point_data$direction_x, @point_data$direction_y, and @point_data$direction_z. Tracking metadata (method, minfa, maxangle) are stored in @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
#> [1] 1