RapidParc

Segment the 1 Million Streamlines of a Human Brain in One Second (100x Faster than SOTA)

Published

November 26, 2026

Github Repository PyPI - RapidParc Paper DOI

Introduction

RapidParc is the framework and paper that resulted from my master’s thesis.

Most likely, you are not familiar with tractograms if you have never dug into the medical neuroimaging domain. Using diffusion MRI (dMRI) techniques and processing (“tractography”), we can obtain models of nerve fibers (Video, Wiki). Each of these nerve fiber models is called a streamline. We call all streamlines of the brain a tractogram. A streamline is coarser than an actual nerve fiber because dMRI has a relatively coarse voxel resolution (\text{mm} vs \mu\text{m}).

But for further scientific investigation, it would be great to have them segmented into white matter tracts. There already exist methods for segmenting tractograms, like TractCloud and DeepWMA. But these methods require at least 100 seconds for a tractogram with 1 million streamlines on an NVIDIA A100 machine and more than 1000 seconds (~17 minutes) on a CPU-only machine (which is more relevant for many clinical scenarios). During my master’s thesis, I developed a framework that is 100x faster while increasing prediction accuracy. These findings resulted in the open-source framework RapidParc and the peer-reviewed paper (shared first authorship):

Valentin von Bornhaupt, Justus Bisten1, Johannes Grün, Tobias Bauer, Theodor Rüber, Thomas Schultz.
RapidParc: A Global-Context Transformer for Parallel, Accurate, and Lesion-Robust Tractogram Parcellation.
Imaging Neuroscience (2026). DOI: 10.1162/IMAG.a.1168

Even though I am writing this blog post as an individual, I would like to emphasize that the achievements are the result of the work of all those involved. In particular, I would like to highlight Justus Bisten’s model improvements regarding post-hemispherotomy robustness and his extensive TractCloud-variant and tractography comparisons. Thomas Schultz and Johannes Grün advised and supported me while I was working on this master’s thesis. I enjoyed the productive brain storming sessions with you. Many thanks also to Prof. Jan Hasenauer, who co-supervised my thesis, and to Tobias Bauer and Theodor Rüber, who provided post-hemispherotomy data.

What made this project rather complex?

Core Problem Definition

  • Given: A tractogram of a subject, i.e., a set of \approx 1 million streamlines (3D paths). Each streamline is a list of 3D coordinates (supporting points).
  • Task: Assign each streamline to one of 42 anatomical classes and one outlier class.

Tractogram Classification

A Tractogram: A Set of Paths, All Different Lengths

Each streamline can have a different number of supporting points, which complicates batch processing. To account for this, RapidParc’s approach is to map every streamline to a fixed-size vector and process bags of these vectors in parallel.

The solution: resample to 15 (or 8) supporting points per streamline (as done in DeepWMA2 (2020) and TractCloud3 (2023)).

Flip-Invariance

There is no unique way to store an undirected path as a vector. Which end do you start from? But I developed a method for it. See more in my separate post on my flip-invariant embedding.

Figure 1: PCA of streamlines without flip-invariant embedding
Figure 2: PCA of flip-invariant embedded streamlines

Registration-Free Approach

Tractograms are highly individual, as they reflect the neural connections within a subject’s brain. While children have small brains and adults have large ones, some people have narrower or wider brains than others (scaling).

Furthermore, tractograms depend on the dMRI imaging conditions: How was the subject positioned in the MRI scanner (rotation, translation)?

There are two main approaches to handle these differences in the domain of tractogram segmentation:

  • Methods like DeepWMA register unseen tractograms to a common template (by applying linear rotations, translations and scalings). Streamlines taken from registered tractograms can be classified using simpler, path-wise classification methods. But registration is expensive (time + compute) and is typically designed for healthy anatomy. What if subjects have altered white matter (e.g., due to heavy lesions, tumors or post-hemispherotomy)? Registration can fail, causing the whole pipeline to fail.
  • Methods like TractCloud and RapidParc are registration-free, i.e., they process tractograms without prior registration. But if a tractogram is not registered, streamline-wise classification is no longer possible: The raw coordinates of a streamline taken from a five-year-old child behave totally differently from those of a 67-year-old adult. Therefore, the model needs global context about the entire tractogram.

How RapidParc Became Registration-Free

  1. Tractogram Normalization: We normalize every tractogram to [-1,\, 1]^3 using min-max scaling. This prevents any dependency on (axis-specific) scaling and translation.
  2. Data Augmentations: During training, we applied random data augmentations:
    • Random rotations by \text{Unif}([-45^\circ, 45^\circ]) on the left-right axis
    • Random rotations by \text{Unif}([-10^\circ, 10^\circ]) for both the anterior-posterior and superior-inferior axes
    • Small additive Gaussian noise \mathcal{N}(0, \,0.001^2) to every supporting point
  3. Transformer Model: I created a novel Transformer-based set segmentation pipeline. Please see Section 2.5 and read the interactive post to understand how it works.

Improvement 1: Even More Augmentations

The transformer model is trained on multiple subsets of tractograms in parallel. I thought: What if we apply a different augmentation to every sub-tractogram? In fact, this inflates the number of augmentations per training run to 3.5 million and therefore approximates the desired registration-free behavior even more closely.

Improvement 2: Data & Augmentations on GPU - Double Throughput

At one point, I noticed that the data transfer from CPU to GPU took a lot of time during training. The dataset is small enough to fit permanently on the GPU during training. So I refactored the training pipeline to keep the dataset permanently on the GPU and run all preprocessing and augmentations directly on-device. This doubled the training throughput.

Model Selection: How to Scale to 1 Million Streamlines?

Please read my post on the model mechanism. The linked method is so rapidly because it is a Monte Carlo method for approximating the global tractogram state while classifying whole sub-tractograms all at once.

Figure 3: RapidParc Inference Pipeline

Results

There are two main results:

  1. RapidParc is at least two orders of magnitude faster than other SOTA methods. Vanilla TractCloud uses k-Nearest Neighbors (k-NN) to find the k nearest neighbor streamlines for local context (and random sampling for global context). Our ablation GlobalTractCloud skips the local context and is therefore faster than TractCloud.

Quantitative Results on the TractCloud dataset test split with 20 random augmentations (STA). The RapidParc family is at least two orders of magnitude faster than TractCloud while being more accurate.
  1. RapidParc is much more robust to altered brains. As described in the post about the underlying ML method, this Monte Carlo-based method is inherently much more robust to missing regions. We further reinforced this behavior through streamline dropout augmentations.

Qualitative Results on four subjects after hemispherotomy. Shown are the corticospinal tract (CST; rows 1-2) and the arcuate fasciculus (AF; rows 3-4). The ORG-Atlas (with manually guided registration) serves as a reference in this context.

Footnotes

  1. These authors contributed equally to this work and may, by mutual agreement, alternate the order of their names in citations and personal references.↩︎

  2. Fan Zhang et al. Deep white matter analysis (DeepWMA): Fast and consistent tractography segmentation, Medical Image Analysis (2020) 10.1016/j.media.2020.101761↩︎

  3. Tengfei Xue et al. TractCloud: Registration-Free Tractography Parcellation with a Novel Local-Global Streamline Point Cloud Representation, MICCAI (2023) 10.1007/978-3-031-43993-3_40↩︎