Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:freesurfer/freesurfer into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
brf2 committed Dec 19, 2020
2 parents c7d6508 + 334c98e commit aef70d2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
39 changes: 28 additions & 11 deletions scripts/groupstats
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set aparclist = (aparc BA aparc.a2009s)
set ASegLUT = $FREESURFER_HOME/ASegStatsLUT.txt
set WMParcLUT = $FREESURFER_HOME/WMParcStatsLUT.txt
set OverWrite = 0;
set mapmeaslist = (thickness area volume curv sulc)
set mapmeaslist = (thickness area volume curv sulc w-g.pct)
set DoAparcStats = 1
set DoAsegStats = 1
set DoWMParcStats = 1
Expand Down Expand Up @@ -125,14 +125,28 @@ foreach aparc ($aparclist)
foreach hemi ($hemilist)
foreach meas ($mapmeaslist)
if($meas == curv || $meas == sulc) continue # curv breaks aparcstats2table
set parc = $aparc
if($aparc == BA) set parc = BA$BAex
if($surf == pial) set parc = pial.$aparc; # only aparc
if($meas == w-g.pct && ($aparc != aparc || $surf != white)) continue
set outfile = $outdir/rois/$aparc.$hemi.$surf.$meas.dat
if(! -e $outfile || $OverWrite) then
set cmd = (aparcstats2table --subjects $slist --hemi $hemi \
-m $meas -t $outfile -p $parc)
echo "#C# $cmd" | tee -a $LF
if($meas != w-g.pct) then
set parc = $aparc
if($aparc == BA) set parc = BA$BAex
if($surf == pial) set parc = pial.$aparc; # only aparc
if(! -e $outfile || $OverWrite) then
set cmd = (aparcstats2table --subjects $slist --hemi $hemi \
-m $meas -t $outfile -p $parc)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
set glmdir = $outdir/rois/glm.$aparc.$hemi.$surf.$meas
set cmd = (mri_glmfit --table $outfile --fsgd $fsgd --glmdir $glmdir)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
endif
else
set cmd = (asegstats2table --subjects $slist -m mean -t $outfile \
--no-segno 0 1000 2000 --statsfile=$hemi.w-g.pct.stats)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
set glmdir = $outdir/rois/glm.$aparc.$hemi.$surf.$meas
Expand All @@ -145,7 +159,8 @@ foreach aparc ($aparclist)
end # hemi
end # surf
end # aparc
endif

endif #DoAparcStats

# ASEG Stats ----------------------------------------------------
if($DoAsegStats) then
Expand Down Expand Up @@ -207,11 +222,13 @@ endif
# Maps and GLM ---------------------------------------
if($DoMaps) then
foreach meas ($mapmeaslist)
set fmt = ()
if($meas == w-g.pct) set fmt = .mgh
foreach hemi ($hemilist)
# concat data ---------------------
set outfile = $outdir/maps/$meas.$hemi.sm00.mgh
if(! -e $outfile || $OverWrite) then
set cmd = (mris_preproc --meas $meas --fsgd $fsgd --hemi $hemi --o $outfile --srcsurfreg $SrcSurfReg)
set cmd = (mris_preproc --meas $meas$fmt --fsgd $fsgd --hemi $hemi --o $outfile --srcsurfreg $SrcSurfReg)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
Expand Down Expand Up @@ -340,7 +357,7 @@ while( $#argv != 0 )
breaksw

case "--no-wmparcstats":
set DoAsegStats = 0
set DoWMParcStats = 0
breaksw

case "--no-stats":
Expand Down
13 changes: 7 additions & 6 deletions scripts/groupstatsdiff
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ foreach aparc ($aparclist)
foreach hemi ($hemilist)
foreach meas ($mapmeaslist)
if($meas == curv || $meas == sulc) continue # curv breaks aparcstats2table
if($meas == w-g.pct && ($aparc != aparc || $surf != white)) continue
set Skip = 0;
foreach nomeas ($nomeaslist)
if($meas == $nomeas) then
Expand All @@ -106,7 +107,7 @@ foreach aparc ($aparclist)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
set glmdir = $outdir/rois/glm.diff.$parc.$hemi.$surf.$meas
set glmdir = $outdir/rois/glm.$parc.$hemi.$surf.$meas
set cmd = (mri_glmfit --table $difftable --glmdir $glmdir $gcmd)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
Expand All @@ -131,7 +132,7 @@ foreach hemi ($hemilist other)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
set glmdir = $outdir/rois/glm.diff.$b
set glmdir = $outdir/rois/glm.$b
set cmd = (mri_glmfit --table $difftable --glmdir $glmdir $gcmd)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
Expand All @@ -150,7 +151,7 @@ if($DoCommon) set cmd = ($cmd --common)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
if($status) exit 1;
set glmdir = $outdir/rois/glm.diff.wmparc.vol
set glmdir = $outdir/rois/glm.wmparc.vol
set cmd = (mri_glmfit --table $difftable --glmdir $glmdir $gcmd)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
Expand Down Expand Up @@ -180,7 +181,7 @@ if($DoMaps) then
$cmd | tee -a $LF
if($status) exit 1;
# glm ------------------------
set glmdir = $outdir/maps/glm.diff.$meas.$hemi.sm$fwhmstr
set glmdir = $outdir/maps/glm.$meas.$hemi.sm$fwhmstr
set cmd = (mri_glmfit --surface fsaverage $hemi --y $smdifffile --glmdir $glmdir $gcmd)
echo "#C# $cmd" | tee -a $LF
$cmd | tee -a $LF
Expand Down Expand Up @@ -381,7 +382,7 @@ endif
set fsgd1 = $g1dir/group.fsgd
set fsgd2 = $g2dir/group.fsgd
set n = `diff $fsgd1 $fsgd2 | wc -l`
if($n != 0) then
if(0 && $n != 0) then
echo "ERROR: fsgd files $fsgd1 and $fsgd2 are not the same"
exit 1;
endif
Expand Down Expand Up @@ -446,7 +447,7 @@ two analyses.
One can then evaluate the differences with something like

tksurfer fsaverage lh inflated -aparc \
-ov diffdir/maps/glm.diff.thickness.lh.sm10/osgm/sig.mgh \
-ov diffdir/maps/glm.thickness.lh.sm10/osgm/sig.mgh \
-t diffdir/maps/diff.thickness.lh.sm10.mgh

The map will indicate OSGM differences and the "time" course will show
Expand Down

0 comments on commit aef70d2

Please sign in to comment.