This is the go-to function to import bundles into R. Based on both VTK and DIPY, we currently
support eight different formats detailed in the documentation of input argument file.
Arguments
- file
A string specifying the path to the file containing the tractography data. Currently supported files are:
- reference_file
A string specifying the path to a reference image file. This is only required when importing
.trx,.fib, or.dpyfiles, as these formats do not contain spatial information about the image space. The reference image is used to correctly position the bundle in the appropriate space. Default isNULL.
Value
A bundle object when the file contains multiple
streamlines, or a streamline object when it contains
exactly one. Each streamline is a numeric matrix with at least three
named columns "X", "Y", and "Z" (one row per point along the
tract). Additional per-point scalar attributes, when present in the source
file, appear as extra named columns.
See also
write_bundle() to export bundles from R.
Examples
uf_left_vtk <- read_bundle(system.file("extdata", "UF_left.vtk", package = "riot"))
#> Number of data points: 38697
#> Number of streamlines: 2042
#> ✔ The bundle stored in /home/runner/work/_temp/Library/riot/extdata/UF_left.vtk has been successfully imported.
