riot (development version)
New features
-
read_bundle()gains abundle_dataargument. An optional named list can now be passed toread_bundle()and will be stored in the@bundle_dataslot of the returnedbundleobject. This makes it easy to attach bundle-level metadata (e.g. subject ID, hemisphere, affine transform) at import time without a separate assignment step. When the file contains a single streamline the argument is ignored with a warning.
Internal changes
-
C++ source files renamed:
fascicle*→bundle*.src/fascicleReaders.{cpp,h}andsrc/fascicleWriters.{cpp,h}have been renamed tosrc/bundleReaders.{cpp,h}andsrc/bundleWriters.{cpp,h}to align with thebundleterminology used throughout the package API. The include guards have been updated accordingly (_BUNDLEREADERS_H,_BUNDLEWRITERS_H). No functional change.
Performance improvements
-
TRK reader is now dramatically faster (up to ~20× on real-world data). Two bottlenecks were removed:
I/O layer: the old
read_trk()calledreadBin()twice per streamline (once fornum_points, once for the point block), causing 2 × N sequential file reads. A new C++ functionReadTRK()replaces the R loop: it reads the entire file body in a singlefread()call, then makes two fast in-memory passes — one to count total points and pre-allocate output vectors, and one to parse coordinates and scalars using directmemcpy-based reads with optional byte-swapping.Bundle assembly:
flat_list_to_bundle()previously evaluatedsid == iinside a loop over all streamlines, making the conversion O(streamlines × points). It now callssplit(seq_along(sid), sid)once (a C-level operation, O(points)) to compute per-streamline index vectors up front. This fix also benefits the VTK/VTP/FDS readers, which share the same conversion function.
Bug fixes
Windows
R CMD checkfix:quartoCLITMPDIRerror. TheR-CMD-checkworkflow now setsQUARTO_PATH=nonexistenton Windows before running the check. ThequartoR package callssystem2("quarto", "-V", env = paste0("TMPDIR=", …)), which on Windows passes the env assignment as a positional argument to the CLI rather than setting it as an environment variable, causingERROR: Unknown command "TMPDIR=…". SettingQUARTO_PATHto a nonexistent value makesfind_quarto()returnNULLimmediately, sosystem2is never called.-
Windows
R CMD checkfix: VTK symbols undefined / linker failures.configure,configure.win,cleanup,cleanup.win, andsrc/Makevars.inhave been removed. They are replaced by a staticsrc/Makevarsthat uses POSIX backtick syntax (per Writing R Extensions) to calltools/configure.Rdirectly at compile time:PKG_CPPFLAGS = `"$(R_HOME)/bin/Rscript" ../tools/configure.R --cppflags` PKG_LIBS = `"$(R_HOME)/bin/Rscript" ../tools/configure.R --libs`tools/configure.Rcallsrvtk::CppFlags()orrvtk::LdFlagsFile(path = "vtk_libs.rsp")(nomodulesargument).LdFlagsFile()writes the complete list of static VTK libraries tosrc/vtk_libs.rspand returns@vtk_libs.rsp, which the linker reads directly — avoiding Windows command-line length limits. Themodulesargument was dropped becauservtk:::filter_libs()matches module names directly against.afilenames: on Windows the files are namedlibvtkIOLegacy-9.5.abut the module names were"VTK_IOLegacy"(uppercase prefix + underscore), so none matched and the.rspfile contained no VTK libraries. On macOS/Linux with system VTK (e.g. homebrew),filter_libsis not called, somoduleswas a no-op there anyway. macOS
R CMD checkfix:_NSEventTrackingRunLoopModenot found.tools/configure.Rcallsrvtk::LdFlagsFile()with an explicitmodulesargument, linking only the VTK I/O and Common modules that riot actually uses. Previously, whenrvtkfell back to its pre-built static bundle (the case for the CRAN binary on macOS CI),-Wl,-all_loadforced every symbol from every.a— including rendering modules that reference_NSEventTrackingRunLoopModefromAppKit.framework— intoriot.so, causingdlopen()to fail at check time.
riot 2.0.0
API rename: read_bundle() and write_bundle()
-
Breaking change:
read_tractogram()andwrite_tractogram()are renamed toread_bundle()andwrite_bundle()for consistency with thebundledata model.
DIPY dependency declaration modernised
- The optional DIPY Python dependency is now declared via
reticulate::py_require("dipy")(reticulate ≥ 1.41) instead of the previous manualpy_module_available()check. Reticulate will automatically provision DIPY in an ephemeral virtual environment when one of the DIPY-backed formats (.trx,.fib,.dpy) is first used.
S7 data model: streamline and bundle classes moved to {fiber}
-
Breaking change: the
maf_dftibble (with columnsX,Y,Z,PointId,StreamlineId) is replaced by two S7 classes now defined in thefiberpackage:-
streamline— stores three typed slots accessed with@:-
@points: an numeric matrix with columns"X","Y","Z"for the ordered coordinates of the points along the tract.PointIdis implicit in row order and is no longer stored. -
@point_data: a named list of numeric vectors of length , holding per-point scalar attributes (e.g. fractional anisotropy at each point). -
@streamline_data: a named list of numeric scalars (length-1 vectors) holding per-streamline attributes (e.g. a tract-level weight or mean FA).
-
-
bundle— stores two typed slots:-
@streamlines: a list ofstreamlineobjects.StreamlineIdis implicit in list position and is no longer stored. -
@bundle_data: a named list of bundle-level metadata (e.g. the affine transform used during tracking).
-
-
-
riot no longer depends on S7 directly; the S7 classes, constructors, predicates, and methods (
streamline(),is_streamline(),bundle(),is_bundle(),format(),print(),length(),[[,[, …) are all provided by fiber and re-exported from there. - riot now imports fiber instead of S7.
-
read_bundle()returns astreamlinewhen the file contains exactly one tract, and abundleotherwise. -
write_bundle()accepts bothstreamlineandbundleobjects. - The
readrpackage is no longer a dependency.
C++ layer: elimination of intermediate CSV files
-
Breaking change (internal): the C++ reader functions (
ReadVTK,ReadVTP,ReadFDS) no longer write a temporary CSV file. They now return acpp11::writable::listdirectly to R, eliminating all temporary file I/O and the associated string-reference issues. - The C++ writer functions (
WriteVTK,WriteVTP,WriteFDS) no longer read from a temporary CSV. They now accept acpp11::listdirectly from R. - The helper
WriteCSV(vtkPolyData → CSV) andReadCSV(CSV → vtkPolyData) are replaced byPolyDataToListandListToPolyDatarespectively, operating entirely in memory.
VTK bindings delegated to rvtk
- VTK discovery, compilation flags, and pre-built static library distribution are now handled entirely by the
rvtkpackage (pending CRAN submission).rvtksupplies pre-compiled VTK headers and libraries so that no manual VTK installation is required on most platforms: it honours a user-suppliedVTK_DIRenvironment variable first, then tries Homebrew (macOS),pkg-config(macOS/Linux), and well-known system prefixes; on Windows it checksVTK_DIR, Rtools45 pacman, and common MSYS2 prefixes; if no suitable system VTK is found it downloads pre-built static libraries automatically from thervtkGitHub releases. -
rvtkis listed as anImportsdependency; downstream packages no longer need to locate VTK themselves. - The
Remotes: astamm/rvtkfield will be removed fromDESCRIPTIONoncervtkis available on CRAN.
riot 1.2.0
-
Breaking change in system requirements: riot no longer bundles VTK source files. Instead, it links against an externally installed VTK (>= 9.1.0) at compile time. VTK must be present on the host before installing the package. Both shared and static VTK builds are supported; static builds on macOS and Linux must have been compiled with
-fPIC. - VTK is discovered at install time via
configure/configure.winusing, in order of preference:- A user-supplied
VTK_DIRenvironment variable. - Homebrew (macOS).
-
pkg-config(macOS and Linux). - Well-known system include paths (
/usr,/usr/local) (Linux). - The Rtools42+ pacman package for the active MSYS2 environment (e.g.
mingw-w64-ucrt-x86_64-vtkfor UCRT64) (Windows).
- A user-supplied
- On Windows, VTK is loaded dynamically at run time via
addDLLDirectory()to avoid having to bundle VTK runtime DLLs inside the package. - Removed all bundled VTK source files, reducing the installed package size considerably.
- Updated
SystemRequirementsinDESCRIPTIONto document the external VTK dependency.
riot 1.1.1
- Modified VTK source files to avoid compilation warnings arising when using LLVM or Apple clang or GNU gcc compilers.
- Now ships a shrunk version of VTK source files to avoid unsuccessful downloads from VTK website.
- Fix compilation errors in
vtkzlibraised byclang16.
riot 1.1.0
CRAN release: 2023-01-06
- Update VTK to
v9.2.4; - Avoid some prototype checks for
vtkzlibwhen using LLVM Clang compiler.
riot 1.0.0
CRAN release: 2022-05-10
In this first major release, we:
- Added support to read MRtrix
.tck/.tsffile formats (#5). - Added support to read TrackVis
.trkfile formats (#5). - Use only one core to compile VTK for compliance with CRAN policy (thanks to Prof. B. Ripley).
- Added tilde expansion on file paths.
We make it the first major release as we consider that the most popular tractography formats are now supported by riot. We chose by design to support only VTK and medInria file formats for writing.
