How to use DIPY BUndle ANalytics (BUAN) for pyAFQ Tractometry?

Hello everyone,

I’m new to exploring tractometry techniques.

My objective is to compare diffusion metrics (FA, MD, AD and RD) between three groups.

I performed a pre-processing step with QSIPREP and a reconstruction using a modified version of the mrtrix_multishell_msmt_pyafq_tractometry pipeline, allowing me to obtain segmented bundles (.trk) as well as a CSV file for each subject. This CSV file shows the value of the metrics for each tract over the 100 points defined by pyAFQ.

Using Python code, I was able to calculate the average metrics for each group on the different tracts, as shown in the following figure :

However, in order to obtain more precise statistics to determine any correlation between the groups, it seems necessary to carry out a statistical test for each point along the tract and for each group.

After some research, it seems that the DIPY Bundle ANalytics - BUAN tools (described here: Bundle analytics, a computational framework for investigating the shapes and profiles of brain pathways across populations | Scientific Reports) are best suited to my needs.

However, even after consulting DIPY’s documentation, examining its source code or exploring the forums, I was unable to find the elements needed to reproduce the same graphics and statistics as those presented in the aforementioned article.

If someone have encountered this difficulty or experienced a similar situation, I would be great if you could share some tips.

Thank you.

Hi @MagicLudo,

It looks like this DIPY documentation (DIPY : Docs 1.6.0. - BUndle ANalytics (BUAN) framework) has the code to make similar figures to those in the article you link. Is there anything in particular about the documentation and how you would apply it to QSIRecon outputs that is unclear?


Thank you @Steven !

Do you know if there is a python api that will allow me to do these tests? Because the output of QSIPrep doesn’t seem to correspond to the type of tree structure that can be taken as input by dipy_buan_profiles.

Am I obliged to reproduce the same type of tree structure, or is it simpler to carry out the statistical analysis myself, using a specific test (linear mixed model or t-test with Bonferroni correction) on each point between 2 groups?

Hi @MagicLudo,

You can try looking and playing around with some of the source code here


Hello! Not quite an answer to your question, but you might want to take a look at our tractable software, which ingests pyAFQ outputs as its input. This is based on a paper by Nathan Muncy and colleagues: General additive models address statistical issues in diffusion MRI: An example with clinically anxious adolescents - PMC.

The idea is to use GAM models to account for the variation along the length of a bundle. The software is in pre-alpha status, but we’ve already published some work that used it (, and have several other projects in the pipeline that use this approach. Let us know if you get a chance to try it out and run into any issues – we are interested in improving it’s usability.

1 Like

Hello @MagicLudo,

Thank you for your question. You can use the dipy_buan_profiles commandline (DIPY — dipy 1.8.0 documentation) to generate bundle profiles of tracts with microstructural values associated with them. It will output .h5 files per bundle per metric, which you can use to do statistical analysis. You might need to make some changes to the default linear mixed model code, as currently, it only supports two groups. I am happy to help with any changes you require in the code or have any questions. Please reach out to me at


1 Like