Differences between revisions 46 and 47
Deletions are marked like this. Additions are marked like this.
Line 34: Line 34:
# generating_program /usr/local/freesurfer/dev/bin/dmri_pathstats
# cvs_version
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /autofs/cluster/f
reesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni
/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/dif
fusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/c
luster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14
/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/c
luster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14
/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt
# generating_program /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats --intrc /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt 
Line 45: Line 38:
# hostname compute-0-10.local # hostname node0305
Line 47: Line 40:
# user ayendiki # user rspriti
Line 53: Line 46:
Count 400
Volume 416
Len_Min 44
Len_Max 83
Len_Avg 59.0325
Len_Center 55
AD_Avg 0.00103

AD_Avg_Weight 0.00105892
AD_Avg_Center 0.00104386

RD_Avg 0.00047195
RD_Avg_Weight 0.000461937
RD_Avg_Center 0.000487178
MD_Avg 0.00065796
5
MD_Avg_Weight 0.000660932
MD_Avg_Center 0.00067273
7
FA_Avg 0.472827
FA_Avg_Weight 0.495202
FA_Avg_Center 0.457536
Count 1000
Volume 327
Len_Min 35
Len_Max 70
Len_Avg 53.119
Len_Center 48
AD_Avg 0.00106102

AD_Avg_Weight 0.00108794
AD_Avg_Center 0.00105527

RD_Avg 0.000438781
RD_Avg_Weight 0.000430744
RD_Avg_Center 0.000441464
MD_Avg 0.00064619
5
MD_Avg_Weight 0.000649809
MD_Avg_Center 0.00064606
7
FA_Avg 0.519271
FA_Avg_Weight 0.539241
FA_Avg_Center 0.511358
Line 94: Line 87:
# generating_program /usr/local/freesurfer/dev/bin/dmri_pathstats
# cvs_version
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt
# generating_program /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats --intrc /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt 
Line 98: Line 91:
# hostname compute-0-10.local # hostname node0305
Line 100: Line 93:
# user ayendiki # user rspriti
Line 108: Line 101:
64 63 9 0.000948384 0.00073031 0.000803001 0.208943
64 63 10 0.000925661 0.000457926 0.000613837 0.421615
65 63 11 0.000894246 0.000381521 0.000552429 0.498782
66 64 12 0.000968373 0.000502922 0.000658072 0.433094
66 64 13 0.000863534 0.000414835 0.000564402 0.461517
66 64 14 0.000770136 0.000358582 0.000495767 0.49394
66 63 13 0.00103657 0.000574918 0.000728804 0.374774
66 63 14 0.00100453 0.000480365 0.000655088 0.478045
Line 115: Line 104:
67 65 16 0.000948329 0.000367791 0.000561303 0.547419
68 65 17 0.00106946 0.000358134 0.000595243 0.606953
68 65 18 0.00151718 0.000592101 0.000900461 0.534194
68 65 19 0.00135883 0.000377419 0.000704556 0.675608
67 64 16 0.000946625 0.000421327 0.000596426 0.521222
68 64 17 0.000967142 0.000305692 0.000526175 0.646745
68 64 18 0.00114626 0.000333594 0.000604484 0.658591
69 65 19 0.00152806 0.000740932 0.00100331 0.426333
Line 120: Line 109:
69 66 21 0.00145087 0.000448438 0.000782583 0.639517
70 66 22 0.00124617 0.000204701 0.000551856 0.816332
69 65 21 0.00140243 0.000482392 0.000789071 0.611696
70 65 21 0.00143949 0.000480912 0.000800438 0.618516
70 65
22 0.00116007 0.000156374 0.000490939 0.858895
Line 130: Line 120:
74 66 31 0.00122871 0.000405738 0.000680061 0.61046 73 66 31 0.00108715 0.000344163 0.000591825 0.649467
Line 132: Line 122:
74 66 33 0.00114455 0.000346198 0.000612314 0.645275
75 66 34 0.00112261 0.000553555 0.000743239 0.42294
75 66 35 0.00110073 0.00039228 0.000628431 0.585723
75 66 36 0.00107757 0.000424713 0.000642332 0.547048
76 65 37 0.00118618 0.000364568 0.000638438 0.650797
76 65 38 0.00110045 0.000451365 0.000667728 0.549521
76 65 39 0.00106488 0.000434208 0.000644432 0.531777
77 65 40 0.000936571 0.000390726 0.000572674 0.504019
78 65 41 0.000790065 0.000547796 0.000628552 0.222685
79 64 41 0.000737992 0.000527606 0.000597735 0.200474
78 63 42 0.000864033 0.000533149 0.000643444 0.291817
78 63 43 0.000783214 0.000517068 0.000605783 0.256042
74 65 33 0.00117648 0.000367445 0.000637124 0.632389
75 65 34 0.00121643 0.000516448 0.000749775 0.502467
75 65 35 0.00104831 0.000392371 0.000611016 0.558318
75 65 36 0.00104016 0.00040752 0.0006184 0.55437
76 64 37 0.00119495 0.000322181 0.000613105 0.688909
76 64 38 0.00105691 0.000334124 0.000575053 0.64994
76 64 39 0.00104479 0.000417371 0.000626511 0.542088
77 64 40 0.000869351 0.000385416 0.000546728 0.477069
77 63 40 0.00090553 0.000409442 0.000574804 0.47172
77 63 41 0.000867782 0.000433106 0.000577998 0.41296
77 63 42 0.000840253 0.000521921 0.000628032 0.287828
Line 146: Line 135:
77 62 45 0.000750971 0.000602391 0.000651918 0.156881
Line 149: Line 137:
75 61 47 0.000852325 0.000501722 0.00061859 0.339727
75 60 48 0.000760404 0.000537457 0.000611772 0.313612
75 61 46 0.000882752 0.000537658 0.000652689 0.310019
75 60
47 0.000851777 0.000522 0.000631926 0.327071
74 60 48 0.000996004 0.000448845 0.000631231 0.488575
Line 152: Line 141:
74 60 50 0.000904047 0.000427675 0.000586466 0.445552 73 59 50 0.000977348 0.000519754 0.000672285 0.429989
Line 156: Line 145:
71 58 54 0.00108069 0.00052145 0.000707864 0.442797 71 59 54 0.000982003 0.000566492 0.000704996 0.387962
Line 158: Line 147:
70 57 56 0.00104198 0.000577465 0.000732302 0.371814
70 57 57 0.000988028 0.000735057 0.000819381 0.208577
69 57 58 0.00118052 0.000811759 0.00093468 0.224508
69 56 59 0.00139945 0.00114833 0.00123204 0.117485
68 56 60 0.00123777 0.000847968 0.000977904 0.246951
70 58 55 0.000978019 0.00032538 0.000542926 0.615096
70 58 56 0.000888766 0.000442273 0.000591104 0.424031

Top | Previous

Tract Statistics

Remember...

For each new terminal that you open, you must do:

setenv SUBJECTS_DIR $TUTORIAL_DATA/diffusion_recons
cd $TUTORIAL_DATA/diffusion_tutorial


This section of the tutorial will teach you how to extract statistical measures for the major white-matter tracts reconstructed by TRACULA. There are two types of statistics files that are created for each white-matter tract:

  • pathstats.overall.txt - This file contains measures averaged over the whole WM tract
  • pathstats.byvoxel.txt - This files contains measures as a function of location along the length of the WM tract.

To view the statistics files from TRACULA for the left cortico-spinal tract of subject Diff001, cd into one subject's directory where the stats are located for this specific tract:

cd $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt

pathstats.overall.txt

You can view the overall path stats by doing:

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt &

Note that lines preceded by the # sign are "commented out". When looking at this file you will see something like this:

# Title Pathway Statistics
#
# generating_program /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats --intrc /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt 
# sysname Linux
# hostname node0305
# machine x86_64
# user rspriti
# anatomy_type pathway
#
# subjectname Diff001
# pathwayname lh.cst
#
Count 1000
Volume 327
Len_Min 35
Len_Max 70
Len_Avg 53.119
Len_Center 48
AD_Avg 0.00106102
AD_Avg_Weight 0.00108794
AD_Avg_Center 0.00105527
RD_Avg 0.000438781
RD_Avg_Weight 0.000430744
RD_Avg_Center 0.000441464
MD_Avg 0.000646195
MD_Avg_Weight 0.000649809
MD_Avg_Center 0.000646067
FA_Avg 0.519271
FA_Avg_Weight 0.539241
FA_Avg_Center 0.511358

This text file contains various diffusion measures, averaged over the entire white-matter tract (for CST). The measures include:

  • Number of sample paths in the WM tract
  • Tract volume (in voxels)
  • Maximum, minimum and average length of sample paths
  • Length of the highest-probability (a.k.a. maximum a posteriori) path
  • Axial diffusivity (average over the entire support of the path distribution, weighted average over the entire support of the path distribution, and average over highest-probability path only)
  • Radial diffusivity (as above)
  • Mean diffusivity (as above)
  • Fractional anisotropy (as above)

pathstats.byvoxel.txt

Now take a look at the by voxel stats:

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt &

It will look something like this:

# Title Pathway Statistics
#
# generating_program /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/stable5_1_0/bin/dmri_pathstats --intrc /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt --dtbase /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dmri/dtifit --path lh.cst --subj Diff001 --out /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --outvox /autofs/cluster/freesurfer/subjects/diffusion_tutorial/Diff001/dpath/5cpts/priormni/seg14/initmni/regflt/lh.cst_AS_avg32_mni_flt/pathstats.byvoxel.txt 
# sysname Linux
# hostname node0305
# machine x86_64
# user rspriti
# anatomy_type pathway
#
# subjectname Diff001
# pathwayname lh.cst
#
# pathway start
x y z AD RD MD FA
66 63 13 0.00103657 0.000574918 0.000728804 0.374774
66 63 14 0.00100453 0.000480365 0.000655088 0.478045
67 64 15 0.000816154 0.000359865 0.000511961 0.547635
67 64 16 0.000946625 0.000421327 0.000596426 0.521222
68 64 17 0.000967142 0.000305692 0.000526175 0.646745
68 64 18 0.00114626 0.000333594 0.000604484 0.658591
69 65 19 0.00152806 0.000740932 0.00100331 0.426333
69 65 20 0.00126399 0.000470638 0.000735089 0.57121
69 65 21 0.00140243 0.000482392 0.000789071 0.611696
70 65 21 0.00143949 0.000480912 0.000800438 0.618516
70 65 22 0.00116007 0.000156374 0.000490939 0.858895
70 66 23 0.00138642 0.000415134 0.000738896 0.650657
71 66 24 0.00134187 0.000385197 0.000704089 0.678151
71 66 25 0.00108983 0.000289931 0.000556565 0.729769
71 66 26 0.00111074 0.000307493 0.000575241 0.693343
72 66 27 0.00117242 0.000398032 0.00065616 0.619191
72 66 28 0.00118738 0.000448541 0.000694819 0.568624
73 66 29 0.00116659 0.000379914 0.000642141 0.613363
73 66 30 0.00121899 0.000442094 0.000701061 0.578963
73 66 31 0.00108715 0.000344163 0.000591825 0.649467
74 66 32 0.00124634 0.000386429 0.000673065 0.632008
74 65 33 0.00117648 0.000367445 0.000637124 0.632389
75 65 34 0.00121643 0.000516448 0.000749775 0.502467
75 65 35 0.00104831 0.000392371 0.000611016 0.558318
75 65 36 0.00104016 0.00040752 0.0006184 0.55437
76 64 37 0.00119495 0.000322181 0.000613105 0.688909
76 64 38 0.00105691 0.000334124 0.000575053 0.64994
76 64 39 0.00104479 0.000417371 0.000626511 0.542088
77 64 40 0.000869351 0.000385416 0.000546728 0.477069
77 63 40 0.00090553 0.000409442 0.000574804 0.47172
77 63 41 0.000867782 0.000433106 0.000577998 0.41296
77 63 42 0.000840253 0.000521921 0.000628032 0.287828
77 63 43 0.000805146 0.000489529 0.000594735 0.301222
77 62 44 0.000815787 0.000565983 0.000649251 0.224909
76 62 45 0.000854533 0.000567732 0.000663332 0.252796
76 61 46 0.000677428 0.00050014 0.000559236 0.193441
75 61 46 0.000882752 0.000537658 0.000652689 0.310019
75 60 47 0.000851777 0.000522 0.000631926 0.327071
74 60 48 0.000996004 0.000448845 0.000631231 0.488575
74 60 49 0.000957188 0.000488566 0.000644774 0.472547
73 59 50 0.000977348 0.000519754 0.000672285 0.429989
73 59 51 0.00104383 0.000519813 0.000694486 0.428315
72 59 52 0.00104503 0.000475882 0.000665599 0.474443
72 59 53 0.00091483 0.00047261 0.000620017 0.409087
71 59 54 0.000982003 0.000566492 0.000704996 0.387962
71 58 55 0.00100269 0.00063635 0.000758462 0.300433
70 58 55 0.000978019 0.00032538 0.000542926 0.615096
70 58 56 0.000888766 0.000442273 0.000591104 0.424031
# pathway end

This text file contains various diffusion measures in each voxel along the highest-probability path. The first three entries in each row are the x, y, z coordinates of the voxel. The remaining entries are the axial diffusivity, radial diffusivity, mean diffusivity, and fractional anisotropy at that voxel.

pathstats.overall.txt to Table Conversion

Measures can be extracted from these files to be analyzed further, e.g., for tract-based group analysis. Specifically, the text files can be converted into a table using the command tractstats2table for doing GLM analyses using mri_glmfit or any other statistical software (SPSS, Excel, Statview etc.)

To extract all diffusion measures for Left Cortico-Spinal tract into a table do the following:

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.All.table
  1. Notice we have specified the stats file with --inputs.
  2. The --overall flag tells tractstats2table to expect the overall path stats file (stats averaged over the entire WM tract) as opposed to the per voxel stats (specified with the --byvoxel flag instead).
  3. The output file will be called Diff001_LH.CST.All.table as specified by the --tablefile flag.

Take a look at the resulting table file:

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.All.table &

Instead of extracting all the measures from pathstats.overall.txt for CST, we could grab just a few specific measures. For example, to extract only the Average Fractional Anisotropy along the Left Cortico-spinal tract, do the following:

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.FA_Avg.table
  1. Notice the --only-measures flag followed by FA_Avg to indicate we are only interested in having the average FA over the path in table format for this path (Left CST).

Take a look at the resulting table file:

gedit $TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/lh.cst_AS.FA_Avg.table &

For a group analysis that has multiple subjects, tractstats2table can be used to combine all the subjects' diffusion measures from the CST path.overall.txt files into a single table that can be used for analysis with mri_glmfit or any other statistics software

An easy way to do this is to create a text file that contains the names of the subjects and paths to their pathstats.overall.txt files. An example is given below:

$TUTORIAL_DATA/diffusion_tutorial/Diff001/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff002/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff003/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff004/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff005/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff006/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff007/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff008/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff009/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/Diff010/dpath/lh.cst_AS_avg32_mni_flt/pathstats.overall.txt

Once this is created and saved as lh.cst_AS.overall.pathstats.list, it can be passed as a parameter to the tractstats2table command. This file has already been created for you. To open this file and view it's contents, do the following

gedit $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list &

The following command will create a table with all the subjects specified in the lh.cst_AS.overall.pathstats file and all the diffusion measures from pathstats.overall.txt for each subject.

tractstats2table --load-pathstats-from-file $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.All.table

We've generated tables of all Diffusion measures for the 10 tutorial subjects for all the 18 tracts. They can be found here:

ls $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/*.All.table

To extract only specific measures like FA_Avg, do the following:

tractstats2table --load-pathstats-from-file $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.overall.pathstats.list --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.FA_Avg.table
  1. Note the use of the --only-measures flag again.
  2. --load-pathstats-from-file will load the statistics from all the subjects specific in lh.cst_AS.overall.pathstats.list file
  3. The FA_Avg parameter for the --only-measures flag can be replaced with other measures specified in pathstats.overall.txt file

You can look at these tables in OpenOffice (or any other spreadsheet program). For example, to open the table lh.cst_AS.All.table in OpenOffice, do the following:

oocalc $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/lh.cst_AS.All.table

From here, you could use these stats files to run a group analysis on the tracts.

Top | Previous

FsTutorial/TraculaStatistics (last edited 2023-07-17 02:37:25 by AnastasiaYendiki)