XTRACT FSL vs MRtrix3 (tckgen)

Dear community:
I was wondering if you might know which are the differences between using XTRACT from FSL to do tractography and MRtrix3 software I believe is tckgen which produces the streamlines. I believe is xtract_blueprints the part of FSL which gives the matrix for structural connectome if I don’t understand the wrong way. My question is what are the main differences.

1 Like


I’ve recently spend a lot of time trying to understand XTRACT, here’s what I learned… First the main thing to note is that the FSL equivalent of tckgen would probably be probtrackx2, which does probabilistic tracking. XTRACT is an automated script that runs probtrackx2 with predefined ROIs and parameters* to extract specific tracts. Here are (breifly) the main differences as I understand it:

Tractography algorithm and inputs

XTRACT: probtrackx2 with inputs from BedpostX

tckgen: a variety of algorithms, but no direct equivalent of probtrackx2. Input can be tensors, peaks or FOD image in SH format (depending on choice of algorithm).

ROIs / Targeted tractography

XTRACT: predefined ROIs (seed, include, exclude) which you can find in the directory $FSLDIR/data/xtract_data. These are registered to the image to automatically extract the tracts.

tckgen: Tract ROIs need to be provided manually using the -seed_image, -exclude and -include flags. There’s nothing stopping you using the ROIs XTRACT uses, but they’ll need transforming from MNI space to your target image.


XTRACT: “densityNorm.nii.gz”, basically a track density image (TDI) / streamline visitation map. As far as I know there’s no (sanctioned) way to get the tractography streamlines from probtrackx.

tckgen: Streamlines in .tck file format. You can convert to TDI using tckmap.

Feel free to ask if there’s anything more detailed you don’t understand!

As for xtract_blueprints, I have no experience with using this (or structural connectomics in MRtrix for that matter), but from the documentation it looks like you have to first run XTRACT to get the tract maps and then run xtract_blueprints to get connections based on the tract maps, so I suppose this would be akin to running an MRtrix connectome pipeline.

* XTRACT parameters

I once considered “converting” XTRACT to MRtrix3, so I had a detailed look at the probtrackx2 commands it uses. But since BedpostX and probtrackx2 are very specific algorithms and formats, you won’t be able to exactly replicate the tracking behaviour itself. I’ll just paste what I wrote down at the time here, in case it’s of any interest. I never actually bothered implementing this though, so I make zero guarantees…

Full probtrackx2 command constructed by XTRACT (for each tract):

probtrackx2 -s bedpostX//merged -m bedpostX//nodif_brain_mask -V 1 --loopcheck --forcedir --opd --ompl --seedref=fsl/data/standard/MNI152_T1_1mm --sampvox=1 --randfib=1   --seedref=fsl/data/standard/MNI152_T1_1mm --xfm=MNI/standard2acpc_dc.nii.gz --invxfm=MNI/acpc_dc2standard.nii.gz  --avoid=fsl/data/xtract_data/Human/cst_l/exclude --nsamples=3000 -x fsl/data/xtract_data/Human/cst_l/seed  --waypoints=xtract//tracts/cst_l/targets.txt  -o density --dir=xtract//tracts/cst_l; fslmaths xtract//tracts/cst_l/density -div `cat xtract//tracts/cst_l/waytotal` xtract//tracts/cst_l/densityNorm
xtract / probtrackx command option Meaning MRtrix / tckgen substitution
-s […]/merged samples wm_fod.mif
-m [..]/nodif_brain_mask tracking mask -mask [..]/nodif_brain_mask
-V 1 verbosity -
--loopcheck “Perform loopchecks on paths - slower, but allows lower curvature threshold” !no equivalent
--forcedir “Use the actual directory name given - i.e. don’t add + to make a new directory” -
--opd “Output path distribution” output is streamline density (visitation) map run tckmap on output:
tckmap out.tck density.nii.gz
--ompl “Output mean path length from seed”
”the average length of the streamlines up to that point can also be stored by setting the --ompl flag”
!no equivalent (although it’s not clear where / if this output is actually used by xtract)
--seedref=fsl/data/standard/MNI152_T1_1mm Reference vol to define seed space in simple mode - diffusion space assumed if absent use pre-transformed ROI images
--sampvox=1 Sample random points within a sphere with radius x mm from the center of the seed voxels (e.g. --sampvox=0.5, 0.5 mm radius sphere). Default=0 !no direct equivalent (seed sampling already random. could dilate seed mask by radius x?)
--randfib=1 Default 0. Set to 1 to randomly sample initial fibres (with f > fibthresh).
Set to 2 to sample in proportion fibres (with f>fibthresh) to f.
Set to 3 to sample ALL populations at random (even if f<fibthresh)
JISCMail - FSL Archives
!no equivalent
--seedref=fsl/data/standard/MNI152_T1_1mm — repetition?? — use pre-transformed images
--xfm=MNI/standard2acpc_dc.nii.gz Transform taking seed space to DTI space (either FLIRT matrix or FNIRT warpfield) - default is identity use pre-transformed image
-invxfm=MNI/acpc_dc2standard.nii.gz Transform taking DTI space to seed space (compulsory when using a warpfield for seeds_to_dti) use pre-transformed images
--avoid=fsl/data/xtract_data/Human/cst_l/exclude Reject pathways passing through locations given by this mask -exclude
--nsamples=3000 Number of samples - default=5000
”The number of individual streamlines (or samples) that are drawn in each voxel or surface vertex can be set using the -P/–nsamples flag […]. By default this is set to 5000 as we are confident that convergence is reached with this number of samples. However, reducing this number will speed up processing and can be useful for preliminary or exploratory analyses.”
? no equivalent?
Seems to be specific to probtrackx algorithm. Maybe close to -seed_random_per_voxel and / or -max_attempts_per_seed?
-x fsl/data/xtract_data/Human/cst_l/seed Seed volume or list (ascii text file) of volumes and/or surfaces -seed_image
--waypoints=xtract//tracts/cst_l/targets.txt Waypoint mask or ascii list of waypoint masks - only keep paths going through ALL the masks -include
-o density Output file out.tck
--dir=xtract//tracts/cst_l Directory to put the final volumes in - code makes this directory - default='logdir’ -
fslmaths xtract//tracts/cst_l/density -div cat xtract//tracts/cst_l/waytotal xtract//tracts/cst_l/densityNorm “waytotal - a text file containing a single number corresponding to the total number of generated tracts that have not been rejected by inclusion/exclusion mask criteria.”
normalise density by dividing with total (accepted) seed count
tckinfo out.tck | grep "^\scount" | sed 's/^. //' > waytotal;
mrcalc density.nii.gz $(cat waytotal) -div densityNorm.nii.gz