Differences between revisions 44 and 51 (spanning 7 versions)
Revision 44 as of 2011-11-22 16:59:23
Size: 13151
Comment:
Revision 51 as of 2013-04-25 23:57:11
Size: 14628
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
= Tract Statistics = = Tract statistics =
Line 13: Line 13:
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
This section of the tutorial will teach you how to extract statistics on anisotropy and diffusivity measures for the white-matter pathways 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 tract
 * pathstats.byvoxel.txt - This files contains measures as a function of location along the trajectory of the tract.

To view the statistics files from TRACULA for the left corticospinal tract of subject elmo.2012, {{{cd}}} into one subject's directory where the stats are located for this specific tract:

{{{
cd $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr
Line 27: Line 27:
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:
gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt &
}}}

T
his file you will see something like this:
Line 35: Line 36:
# 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/Diff0
01/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
# cvs_version 
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr --dtbase /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dmri/dtifit --path lh.cst --subj elmo.2012 --out /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --outvox /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt 
Line 45: Line 39:
# hostname compute-0-10.local # hostname compute-0-29
Line 50: Line 44:
# subjectname Diff001 # subjectname elmo.2012
Line 53: Line 47:
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.000657965
MD_Avg_Weight 0.000660932
MD_Avg_Center 0.000672737
FA_Avg 0.472827
FA_Avg_Weight 0.495202
FA_Avg_Center 0.457536
}}}
This text file contains various diffusion measures, averaged over the entire white-matter tract (for CST). The measures include:
Count 1500
Volume 715
Len_Min 40
Len_Max 74
Len_Avg 55.5307
Len_Center 54
AD_Avg 0.00122351
AD_Avg_Weight 0.00122372
AD_Avg_Center 0.00130183
RD_Avg 0.000480397
RD_Avg_Weight 0.000459075
RD_Avg_Center 0.000466175
MD_Avg 0.000728101
MD_Avg_Weight 0.000713958
MD_Avg_Center 0.000744727
FA_Avg 0.546698
FA_Avg_Weight 0.567694
FA_Avg_Center 0.580328
}}}

This text file contains various diffusion measures, averaged over the entire white-matter tract (in case, left CST). The measures include:
Line 84: Line 79:
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 &
Now take a look at the stats as a function of position along the trajectory of the tract:

{{{
gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt &
Line 95: Line 90:
# 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
# cvs_version 
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr --dtbase /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dmri/dtifit --path lh.cst --subj elmo.2012 --out /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --outvox /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt 
Line 98: Line 93:
# hostname compute-0-10.local # hostname compute-0-29
Line 103: Line 98:
# subjectname Diff001 # subjectname elmo.2012
Line 107: Line 102:
x y z AD RD MD FA
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
67 64 15 0.000816154 0.000359865 0.000511961 0.547635
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
69 65 20 0.00126399 0.000470638 0.000735089 0.57121
69 66 21 0.00145087 0.000448438 0.000782583 0.639517
70 66 22 0.00124617 0.000204701 0.000551856 0.816332
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
74 66 31 0.00122871 0.000405738 0.000680061 0.61046
74 66 32 0.00124634 0.000386429 0.000673065 0.632008
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
77 63 43 0.000805146 0.000489529 0.000594735 0.301222
77 62 44 0.000815787 0.000565983 0.000649251 0.224909
77 62 45 0.000750971 0.000602391 0.000651918 0.156881
76 62 45 0.000854533 0.000567732 0.000663332 0.252796
76 61 46 0.000677428 0.00050014 0.000559236 0.193441
75 61 47 0.000852325 0.000501722 0.00061859 0.339727
75 60 48 0.000760404 0.000537457 0.000611772 0.313612
74 60 49 0.000957188 0.000488566 0.000644774 0.472547
74 60 50 0.000904047 0.000427675 0.000586466 0.445552
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 58 54 0.00108069 0.00052145 0.000707864 0.442797
71 58 55 0.00100269 0.00063635 0.000758462 0.300433
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
x y z AD RD MD FA AD_Avg RD_Avg MD_Avg FA_Avg
65 57 7 0.00118293 0.000795514 0.000924652 0.29494 0.0012411 0.00065021 0.000847174 0.413312
65 58 8 0.00130461 0.000852312 0.00100308 0.303386 0.00126797 0.00067465 0.00087242 0.414197
66 58 9 0.000987039 0.000420614 0.000609422 0.564201 0.0011978 0.000575463 0.000782904 0.472474
66 58 10 0.000770995 0.000474497 0.00057333 0.511504 0.00116745 0.000572706 0.000770953 0.480807
66 59 10 0.00137465 0.000632992 0.000880213 0.482655 0.00117906 0.000579347 0.000779252 0.479925
67 59 11 0.0016693 0.000669555 0.0010028 0.546244 0.00130553 0.00062593 0.000852463 0.494413
67 60 12 0.00243464 0.00111706 0.00155625 0.455251 0.00174679 0.000866872 0.00116018 0.454145
67 60 13 0.00141842 0.000204362 0.000609048 0.839111 0.00151862 0.000585438 0.000896501 0.584521
68 61 14 0.00161836 0.000331843 0.000760683 0.763616 0.00134348 0.000325355 0.000664734 0.736045
68 61 15 0.00171234 0.000349839 0.000804007 0.774466 0.00136593 0.000278337 0.00064087 0.780897
68 62 16 0.00223797 0.000726919 0.0012306 0.617768 0.00137806 0.000254121 0.000628773 0.797351
69 62 17 0.00146993 -0.000136951 0.000398677 1.08495 0.00124989 0.000258965 0.000589274 0.758698
69 63 18 0.00159246 0.000313279 0.000739672 0.801038 0.00112357 0.000223923 0.000523805 0.763737
69 63 19 0.00133312 0.00056652 0.000822055 0.539529 0.00118196 0.000311433 0.000601611 0.715623
70 63 20 0.00135216 0.000249305 0.000616922 0.801477 0.00120898 0.000283001 0.000591658 0.760807
70 64 21 0.00139644 0.000311688 0.000673274 0.7436 0.00132602 0.000344539 0.0006717 0.713865
70 65 22 0.00134507 0.000401526 0.00071604 0.657404 0.00131613 0.00037062 0.000685787 0.670652
71 65 23 0.00145485 0.000366251 0.000729117 0.712095 0.00134477 0.000361736 0.000689413 0.688727
71 65 24 0.00123012 0.000327556 0.000628411 0.691863 0.00134998 0.000345911 0.000680602 0.700391
72 66 25 0.00143867 0.000401481 0.00074721 0.671129 0.00132081 0.000358823 0.000679491 0.679251
72 66 26 0.00147251 0.00033693 0.000715457 0.736761 0.00133327 0.000361708 0.000685562 0.680079
72 66 27 0.00150811 0.000357167 0.000740813 0.727197 0.00136524 0.00035091 0.00068902 0.697787
73 66 27 0.0015932 0.000392793 0.000792929 0.714821 0.0013719 0.000342011 0.000685308 0.707984
73 66 28 0.00143389 0.000347546 0.000709662 0.733078 0.00138414 0.000346106 0.00069212 0.71024
74 66 29 0.00139097 0.000313104 0.000672393 0.748987 0.00137769 0.000357109 0.000697305 0.699783
75 65 30 0.00138887 0.000296413 0.000660565 0.763204 0.00137445 0.000368675 0.000703935 0.685756
75 65 31 0.00123684 0.000369694 0.000658743 0.661917 0.00132519 0.000388873 0.000700977 0.655551
76 65 31 0.00135921 0.000378914 0.000705678 0.680003 0.00130156 0.000405338 0.000704078 0.633493
76 65 32 0.00127341 0.000386858 0.000682376 0.657603 0.00124293 0.000423528 0.000696662 0.605364
77 64 33 0.00113978 0.000411559 0.000654298 0.60531 0.00116676 0.000471894 0.000703512 0.542952
77 64 34 0.00128087 0.000422854 0.000708858 0.634704 0.00116979 0.000466386 0.000700857 0.546479
77 64 35 0.00119896 0.000503018 0.000734999 0.528921 0.00114853 0.000488113 0.000708253 0.509877
77 64 36 0.00113656 0.000497799 0.00071072 0.496202 0.00110451 0.000510057 0.00070821 0.461135
77 63 37 0.00119198 0.000515275 0.000740843 0.490595 0.00106561 0.000528038 0.000707233 0.419948
77 63 38 0.00104769 0.000504044 0.000685259 0.430811 0.00103929 0.00054131 0.000707305 0.394736
77 63 39 0.000976591 0.000553614 0.000694606 0.344894 0.00101994 0.000555465 0.000710295 0.373869
77 62 39 0.00105097 0.00053899 0.00070965 0.395267 0.00102415 0.00056409 0.000717448 0.370027
76 62 40 0.00108909 0.000598414 0.000761972 0.38261 0.0010056 0.000593542 0.000730896 0.335987
76 62 41 0.000953437 0.000555378 0.000688064 0.332705 0.000985674 0.000578395 0.000714153 0.334102
76 62 42 0.00103198 0.000585098 0.000734059 0.346136 0.0010228 0.000557608 0.00071267 0.37633
75 61 43 0.0013783 0.000493448 0.000788399 0.57846 0.00120485 0.000499852 0.000734854 0.520561
75 61 44 0.0013578 0.00041386 0.000728508 0.648035 0.00126744 0.000461535 0.000730173 0.584945
74 60 45 0.00146392 0.000421628 0.000769059 0.669326 0.00132196 0.000422634 0.00072241 0.640796
74 60 46 0.00139868 0.000468258 0.000778397 0.614758 0.0012875 0.000432798 0.000717696 0.624331
73 60 47 0.00123032 0.000420786 0.000690632 0.605954 0.00119442 0.000450472 0.000698453 0.582006
73 59 48 0.0011713 0.000516378 0.000734685 0.532527 0.00112359 0.000496344 0.000705423 0.516604
72 59 49 0.0010104 0.000479379 0.000656385 0.483854 0.0010846 0.000519347 0.000707763 0.474383
72 58 50 0.00120508 0.000578986 0.000787684 0.481221 0.00112665 0.000555061 0.000745586 0.450731
71 58 51 0.00124094 0.000534655 0.000770084 0.530706 0.00116266 0.000558386 0.000759811 0.45683
71 58 52 0.00120763 0.000423815 0.000685088 0.616712 0.00115987 0.000551248 0.000754122 0.460011
71 57 53 0.00090392 0.000602734 0.00070313 0.261814 0.0011224 0.000608472 0.000779781 0.391306
70 57 54 0.000903407 0.000462753 0.000609638 0.425374 0.00112904 0.000645592 0.000806739 0.375108
69 56 55 0.00080472 0.000352406 0.000503177 0.479572 0.00114323 0.000690293 0.000841274 0.344521
69 56 56 0.00094346 0.000762745 0.000822983 0.141438 0.00115186 0.0007132 0.000859425 0.331727
Line 165: Line 159:
Line 167: Line 162:
=== 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.
 1. 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).
 1. The output file will be called Diff001_LH.
CST.All.table as specified by the --tablefile flag.
=== Converting pathstats.overall.txt to a table ===
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 the left corticospinal tract into a table do the following:

{{{
tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/lh.cst_AS.All.table
}}}
 1. The argument to the --inputs option specifies the input stats file.
 1. The --overall option tells tractstats2table to expect the overall path stats file (stats averaged over the entire left CST), as opposed to the stats along the trajectory of the tract (which would be specified with the --byvoxel option instead).
 1. The argument to the --tablefile option specifies the output file.
Line 182: Line 177:
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).
gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 FA along the left corticospinal tract, do the following:

{{{
tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/lh.cst_AS.FA_Avg.table
}}}
 1. Here the --only-measures option followed by FA_Avg was used to indicate we are only interested in having the average FA over the path in table format for this tract.
Line 194: Line 189:
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
gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 path.overall.txt files into a single table that can be used for analysis with [[mri_glmfit]] or any other statistics software.
Line 201: Line 196:
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff001/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff002/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff003/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff004/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff005/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff006/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff007/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff008/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff009/dpath/priormni/lh.cst_AS_avg32_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/Diff010/dpath/priormni/lh.cst_AS_avg32_mni_bbr/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
$TUTORIAL_DATA/diffusion_tutorial/elmo.2005/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/elmo.2008/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 its contents, do the following:
Line 222: Line 211:
We've generated tables of all Diffusion measures for the 3 tutorial subjects for all the 18 tracts. They can be found here:

{{{
ls $TUTORIAL_DATA/diffusion_tutorial/TraculaStatFiles/*.All.table
}}}
Line 229: Line 224:
 1. The FA_Avg parameter for the --only-measures flag can be replaced with other measures specified in pathstats.overall.txt file

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 statistics on anisotropy and diffusivity measures for the white-matter pathways 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 tract
  • pathstats.byvoxel.txt - This files contains measures as a function of location along the trajectory of the tract.

To view the statistics files from TRACULA for the left corticospinal tract of subject elmo.2012, cd into one subject's directory where the stats are located for this specific tract:

cd $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr

pathstats.overall.txt

You can view the overall path stats by doing:

gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt &

This file you will see something like this:

# Title Pathway Statistics
#
# generating_program /usr/local/freesurfer/dev/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr --dtbase /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dmri/dtifit --path lh.cst --subj elmo.2012 --out /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --outvox /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt 
# sysname Linux
# hostname compute-0-29
# machine x86_64
# user ayendiki
# anatomy_type pathway
#
# subjectname elmo.2012
# pathwayname lh.cst
#
Count 1500
Volume 715
Len_Min 40
Len_Max 74
Len_Avg 55.5307
Len_Center 54
AD_Avg 0.00122351
AD_Avg_Weight 0.00122372
AD_Avg_Center 0.00130183
RD_Avg 0.000480397
RD_Avg_Weight 0.000459075
RD_Avg_Center 0.000466175
MD_Avg 0.000728101
MD_Avg_Weight 0.000713958
MD_Avg_Center 0.000744727
FA_Avg 0.546698
FA_Avg_Weight 0.567694
FA_Avg_Center 0.580328

This text file contains various diffusion measures, averaged over the entire white-matter tract (in case, left 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 stats as a function of position along the trajectory of the tract:

gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt &

It will look something like this:

# Title Pathway Statistics
#
# generating_program /usr/local/freesurfer/dev/bin/dmri_pathstats
# cvs_version 
# cmdline /usr/local/freesurfer/dev/bin/dmri_pathstats --intrc /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr --dtbase /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dmri/dtifit --path lh.cst --subj elmo.2012 --out /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --outvox /space/freesurfer/subjects/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.byvoxel.txt 
# sysname Linux
# hostname compute-0-29
# machine x86_64
# user ayendiki
# anatomy_type pathway
#
# subjectname elmo.2012
# pathwayname lh.cst
#
# pathway start
x y z AD RD MD FA AD_Avg RD_Avg MD_Avg FA_Avg
65 57 7 0.00118293 0.000795514 0.000924652 0.29494 0.0012411 0.00065021 0.000847174 0.413312
65 58 8 0.00130461 0.000852312 0.00100308 0.303386 0.00126797 0.00067465 0.00087242 0.414197
66 58 9 0.000987039 0.000420614 0.000609422 0.564201 0.0011978 0.000575463 0.000782904 0.472474
66 58 10 0.000770995 0.000474497 0.00057333 0.511504 0.00116745 0.000572706 0.000770953 0.480807
66 59 10 0.00137465 0.000632992 0.000880213 0.482655 0.00117906 0.000579347 0.000779252 0.479925
67 59 11 0.0016693 0.000669555 0.0010028 0.546244 0.00130553 0.00062593 0.000852463 0.494413
67 60 12 0.00243464 0.00111706 0.00155625 0.455251 0.00174679 0.000866872 0.00116018 0.454145
67 60 13 0.00141842 0.000204362 0.000609048 0.839111 0.00151862 0.000585438 0.000896501 0.584521
68 61 14 0.00161836 0.000331843 0.000760683 0.763616 0.00134348 0.000325355 0.000664734 0.736045
68 61 15 0.00171234 0.000349839 0.000804007 0.774466 0.00136593 0.000278337 0.00064087 0.780897
68 62 16 0.00223797 0.000726919 0.0012306 0.617768 0.00137806 0.000254121 0.000628773 0.797351
69 62 17 0.00146993 -0.000136951 0.000398677 1.08495 0.00124989 0.000258965 0.000589274 0.758698
69 63 18 0.00159246 0.000313279 0.000739672 0.801038 0.00112357 0.000223923 0.000523805 0.763737
69 63 19 0.00133312 0.00056652 0.000822055 0.539529 0.00118196 0.000311433 0.000601611 0.715623
70 63 20 0.00135216 0.000249305 0.000616922 0.801477 0.00120898 0.000283001 0.000591658 0.760807
70 64 21 0.00139644 0.000311688 0.000673274 0.7436 0.00132602 0.000344539 0.0006717 0.713865
70 65 22 0.00134507 0.000401526 0.00071604 0.657404 0.00131613 0.00037062 0.000685787 0.670652
71 65 23 0.00145485 0.000366251 0.000729117 0.712095 0.00134477 0.000361736 0.000689413 0.688727
71 65 24 0.00123012 0.000327556 0.000628411 0.691863 0.00134998 0.000345911 0.000680602 0.700391
72 66 25 0.00143867 0.000401481 0.00074721 0.671129 0.00132081 0.000358823 0.000679491 0.679251
72 66 26 0.00147251 0.00033693 0.000715457 0.736761 0.00133327 0.000361708 0.000685562 0.680079
72 66 27 0.00150811 0.000357167 0.000740813 0.727197 0.00136524 0.00035091 0.00068902 0.697787
73 66 27 0.0015932 0.000392793 0.000792929 0.714821 0.0013719 0.000342011 0.000685308 0.707984
73 66 28 0.00143389 0.000347546 0.000709662 0.733078 0.00138414 0.000346106 0.00069212 0.71024
74 66 29 0.00139097 0.000313104 0.000672393 0.748987 0.00137769 0.000357109 0.000697305 0.699783
75 65 30 0.00138887 0.000296413 0.000660565 0.763204 0.00137445 0.000368675 0.000703935 0.685756
75 65 31 0.00123684 0.000369694 0.000658743 0.661917 0.00132519 0.000388873 0.000700977 0.655551
76 65 31 0.00135921 0.000378914 0.000705678 0.680003 0.00130156 0.000405338 0.000704078 0.633493
76 65 32 0.00127341 0.000386858 0.000682376 0.657603 0.00124293 0.000423528 0.000696662 0.605364
77 64 33 0.00113978 0.000411559 0.000654298 0.60531 0.00116676 0.000471894 0.000703512 0.542952
77 64 34 0.00128087 0.000422854 0.000708858 0.634704 0.00116979 0.000466386 0.000700857 0.546479
77 64 35 0.00119896 0.000503018 0.000734999 0.528921 0.00114853 0.000488113 0.000708253 0.509877
77 64 36 0.00113656 0.000497799 0.00071072 0.496202 0.00110451 0.000510057 0.00070821 0.461135
77 63 37 0.00119198 0.000515275 0.000740843 0.490595 0.00106561 0.000528038 0.000707233 0.419948
77 63 38 0.00104769 0.000504044 0.000685259 0.430811 0.00103929 0.00054131 0.000707305 0.394736
77 63 39 0.000976591 0.000553614 0.000694606 0.344894 0.00101994 0.000555465 0.000710295 0.373869
77 62 39 0.00105097 0.00053899 0.00070965 0.395267 0.00102415 0.00056409 0.000717448 0.370027
76 62 40 0.00108909 0.000598414 0.000761972 0.38261 0.0010056 0.000593542 0.000730896 0.335987
76 62 41 0.000953437 0.000555378 0.000688064 0.332705 0.000985674 0.000578395 0.000714153 0.334102
76 62 42 0.00103198 0.000585098 0.000734059 0.346136 0.0010228 0.000557608 0.00071267 0.37633
75 61 43 0.0013783 0.000493448 0.000788399 0.57846 0.00120485 0.000499852 0.000734854 0.520561
75 61 44 0.0013578 0.00041386 0.000728508 0.648035 0.00126744 0.000461535 0.000730173 0.584945
74 60 45 0.00146392 0.000421628 0.000769059 0.669326 0.00132196 0.000422634 0.00072241 0.640796
74 60 46 0.00139868 0.000468258 0.000778397 0.614758 0.0012875 0.000432798 0.000717696 0.624331
73 60 47 0.00123032 0.000420786 0.000690632 0.605954 0.00119442 0.000450472 0.000698453 0.582006
73 59 48 0.0011713 0.000516378 0.000734685 0.532527 0.00112359 0.000496344 0.000705423 0.516604
72 59 49 0.0010104 0.000479379 0.000656385 0.483854 0.0010846 0.000519347 0.000707763 0.474383
72 58 50 0.00120508 0.000578986 0.000787684 0.481221 0.00112665 0.000555061 0.000745586 0.450731
71 58 51 0.00124094 0.000534655 0.000770084 0.530706 0.00116266 0.000558386 0.000759811 0.45683
71 58 52 0.00120763 0.000423815 0.000685088 0.616712 0.00115987 0.000551248 0.000754122 0.460011
71 57 53 0.00090392 0.000602734 0.00070313 0.261814 0.0011224 0.000608472 0.000779781 0.391306
70 57 54 0.000903407 0.000462753 0.000609638 0.425374 0.00112904 0.000645592 0.000806739 0.375108
69 56 55 0.00080472 0.000352406 0.000503177 0.479572 0.00114323 0.000690293 0.000841274 0.344521
69 56 56 0.00094346 0.000762745 0.000822983 0.141438 0.00115186 0.0007132 0.000859425 0.331727
# 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.

Converting pathstats.overall.txt to a table

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 the left corticospinal tract into a table do the following:

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --overall --tablefile $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/lh.cst_AS.All.table
  1. The argument to the --inputs option specifies the input stats file.
  2. The --overall option tells tractstats2table to expect the overall path stats file (stats averaged over the entire left CST), as opposed to the stats along the trajectory of the tract (which would be specified with the --byvoxel option instead).
  3. The argument to the --tablefile option specifies the output file.

Take a look at the resulting table file:

gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 FA along the left corticospinal tract, do the following:

tractstats2table --inputs $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt --overall --only-measures FA_Avg --tablefile $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/lh.cst_AS.FA_Avg.table
  1. Here the --only-measures option followed by FA_Avg was used to indicate we are only interested in having the average FA over the path in table format for this tract.

Take a look at the resulting table file:

gedit $TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 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/elmo.2005/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/elmo.2008/dpath/lh.cst_AS_avg33_mni_bbr/pathstats.overall.txt
$TUTORIAL_DATA/diffusion_tutorial/elmo.2012/dpath/lh.cst_AS_avg33_mni_bbr/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 its 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 3 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)