Is any method to extract white matter tract profile of a group of subjects and draw a curve?

Hi,

I have tracked some white matter tracts in two groups of subjects, and I want to draw a curve graph of to show the diffusion properties (such as MD, FA) of each group with mean +/- SD. The x axis represents the position of the tract and the y axis represents the MD value.

Up to now, I have only found the way to show the curve of only graph by DIPY or AFQ. But how to do it for a group?

Thanks

Hi @Roger1219,

If you used AFQ you should also have a csv with tract profile values. You’ll need to aggregate them to a dataframe like this:

node   tract    sub    value
0     Left_AF sub-001  0.2 (or whatever the value was)
1     Left_AF sub-001  0.3 (or whatever the value was)
....
n     Left_AF sub-001  X
0     Left_AF sub-002  X
.... (REPEAT FOR ALL SUBS AND TRACTS)

Name that dataframe something like df_tract you can do

import seaborn as sns
tract_vals = df_tract.query("tract == 'Left_AF'") # or whatever tract you want
sns.lineplot(data=tract_vals, x="node", y="value", orient="y")

For documentation on this seaborn command, see seaborn.lineplot — seaborn 0.12.2 documentation

Best,
Steven

2 Likes

You might also be interested to check out our AFQ Insight software that deals with group level data processes with pyAFQ. Here’s an example that includes some group level plots: Harmonize HBN data using ComBat — AFQ-Insight 0.3.4 documentation

Another option is the BUAN framework which includes group level comparisons: DIPY : Docs 1.5.0 - BUndle ANalytics (BUAN) framework

1 Like

Thanks for your reply, My tracts were generated by mrtrix3, so I don’t have the css file with the node information. Is there some functions to generate this file manually?

Hi @Roger1219,

Mrtrix3 doesn’t have a tract bundle segmentation algorithm as far as I know. In either case, if you have .tck files for your bundles, you can use tcksample (tcksample — MRtrix 3.0 documentation) or use DIPY to generate AFQ-like profiles (DIPY : Docs 1.7.0 - Extracting AFQ tract profiles from segmented bundles).

Best,
Steven

Thank you all.
I have solved this problem with the following method.

  1. extract the profile of each tract (.tck) generated from mrtrix3 before (thanks @Steven )
  2. instead of illustrating the single profile directly as examples in DIPY, I saved the profile into a data frame and used seaborn to show it in group level. (thanks @Steven again!)
2 Likes