TRX in MRtrix3

A typical workflow

Why TRX?

MRtrix streamline file format (tck) contains float32 coordinates and some header information. Additional metadata is stored in separate files. These sidecar files are produced as you map data to streamlines (tsf or sift weights) or streamlines to data (tck2connectome). TRX is a container format that stores geometry, per-streamline data (dps), per-vertex data (dpv), and group memberships together in a single zip file.

This walkthrough demonstrates a complete tractography pipeline run two ways — classic TCK-based and TRX-based — on the same HCP subject, showing that the outputs are numerically identical. The design leaves the TCK-using commands and outputs mostly unchanged, demonstrating that TRX integration will not disrupt existing workflows. The changes to MRtrix3 code source are as small as possible.

It also highlights that the TRX format reduces the number of files produced by the workflow. Using TCK format, we would produce the following files:

tracks.tck              ← 5–15 GB geometry
sift2_weights.csv       ← per-streamline weights
assignments.txt         ← node-pair labels (tck2connectome)
scalar_vertices.tsf     ← per-vertex data

The TRX version just makes one file: tracks.trx.

What you’ll see

Step Classic pipeline TRX pipeline
Generate streamlines tckgen → tracks.tck tckgen → tracks.trx
SIFT2 weighting tcksift2 → weights.csv tcksift2 -trx_dps → (embedded)
Atlas labeling tck2connectome -out_assignment trxlabel → (groups embedded)
Connectome tck2connectome trx2connectome
Inspect state ls *.tck *.csv *.txt tckinfo tracks.trx

The TRX file grows as each step adds metadata; tckinfo at each stage reveals its evolving contents.

Data

A scan from the HCP Young Adult dataset, processed through QSIRecon’s mrtrix_multishell_msmt_hsvs pipeline. Starting inputs:

  • WM FOD (msmt-CSD, max SH order 8)
  • Brain mask (mtnormalize inlier mask)
  • Glasser 360-region atlas (registered to T1w space)

Start the walkthrough