Skip to content

Commit f87e94d

Browse files
committed
run aseg stats also for -fsaparc
1 parent 0735ed3 commit f87e94d

File tree

1 file changed

+48
-49
lines changed

1 file changed

+48
-49
lines changed

recon_surf/recon-surf.sh

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -913,57 +913,56 @@ fi
913913

914914
# ============================= FASTSURFER - STATS =========================================
915915

916-
if [ "$fsaparc" == "0" ] ; then
917-
# get stats for the aseg (note these are surface fine tuned, that may be good or bad, below we also do the stats for the input aseg (plus some processing)
918-
# cmd="recon-all -subject $subject -segstats $hiresflag $fsthreads"
919-
if [[ "$segstats_legacy" == "true" ]] ; then
920-
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/mri_brainvol_stats.py"
921-
--subject "$subject")
922-
RunIt "$(echo_quoted "${cmd[@]}")" "$LF"
923-
924-
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/mri_segstats.py" --seed 1234
925-
--seg "$mdir/aseg.mgz" --sum "$statsdir/aseg.stats" --pv "$mdir/norm.mgz"
926-
"--in-intensity-name" norm "--in-intensity-units" MR --subject "$subject"
927-
--surf-wm-vol --ctab "$FREESURFER_HOME/ASegStatsLUT.txt" --etiv
928-
--threads "$threads")
929-
# cmd="$python $FASTSURFER_HOME/FastSurferCNN/mri_segstats.py --seed 1234 --seg $mdir/wmparc.mgz --sum $statsdir/wmparc.stats --pv $mdir/norm.mgz --in-intensity-name norm --in-intensity-units MR --subject $subject --surf-wm-vol --ctab $FREESURFER_HOME/WMParcStatsLUT.txt --etiv"
930-
else
931-
# calculate brainvol stats and aseg stats with segstats.py
932-
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/segstats.py" --sid "$subject"
933-
--segfile "$mdir/aseg.mgz" --segstatsfile "$statsdir/aseg.stats"
934-
--pvfile "$mdir/norm.mgz" --normfile "$mdir/norm.mgz" --threads "$threads"
935-
# --excl-ctxgmwm: exclude Left/Right WM / Cortex despite ASegStatsLUT.txt
936-
--excludeid 0 2 3 41 42
937-
--lut "$FREESURFER_HOME/ASegStatsLUT.txt" --empty
938-
measures --compute "BrainSeg" "BrainSegNotVent" "VentricleChoroidVol"
939-
"lhCortex" "rhCortex" "Cortex" "lhCerebralWhiteMatter"
940-
"rhCerebralWhiteMatter" "CerebralWhiteMatter"
941-
"SubCortGray" "TotalGray" "SupraTentorial"
942-
"SupraTentorialNotVent" "Mask($mdir/mask.mgz)"
943-
"BrainSegVol-to-eTIV" "MaskVol-to-eTIV" "lhSurfaceHoles"
944-
"rhSurfaceHoles" "SurfaceHoles"
945-
"EstimatedTotalIntraCranialVol")
946-
RunIt "$(echo_quoted "${cmd[@]}")" "$LF"
947-
echo "Extract the brainvol stats section from segstats output." | tee -a "$LF"
948-
# ... so stats/brainvol.stats also exists (but it is slightly different
949-
# cmd="recon-all -subject $subject -segstats $hiresflag $fsthreads"
950-
# RunIt "$cmd" "$LF"
951-
952-
# this call is only "required" to "compute" brainvol.stats, so --normfile/--pvfile
953-
# are not required
954-
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/segstats.py" --sid "$subject"
955-
--segfile "$mdir/aseg.mgz" --pvfile "$mdir/norm.mgz"
956-
--measure_only --threads "$threads" --segstatsfile "$statsdir/brainvol.stats"
957-
measures --file "$statsdir/aseg.stats"
958-
--import "BrainSeg" "BrainSegNotVent" "SupraTentorial"
959-
"SupraTentorialNotVent" "SubCortGray" "lhCortex" "rhCortex"
960-
"Cortex" "TotalGray" "lhCerebralWhiteMatter"
961-
"rhCerebralWhiteMatter" "CerebralWhiteMatter" "Mask"
962-
--compute "SupraTentorialNotVentVox" "BrainSegNotVentSurf"
963-
"VentricleChoroidVol")
964-
fi
916+
# get stats for the aseg (note these are surface fine tuned, that may be good or bad, below we also do the stats for the input aseg (plus some processing)
917+
# cmd="recon-all -subject $subject -segstats $hiresflag $fsthreads"
918+
if [[ "$segstats_legacy" == "true" ]] ; then
919+
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/mri_brainvol_stats.py"
920+
--subject "$subject")
965921
RunIt "$(echo_quoted "${cmd[@]}")" "$LF"
922+
923+
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/mri_segstats.py" --seed 1234
924+
--seg "$mdir/aseg.mgz" --sum "$statsdir/aseg.stats" --pv "$mdir/norm.mgz"
925+
"--in-intensity-name" norm "--in-intensity-units" MR --subject "$subject"
926+
--surf-wm-vol --ctab "$FREESURFER_HOME/ASegStatsLUT.txt" --etiv
927+
--threads "$threads")
928+
# cmd="$python $FASTSURFER_HOME/FastSurferCNN/mri_segstats.py --seed 1234 --seg $mdir/wmparc.mgz --sum $statsdir/wmparc.stats --pv $mdir/norm.mgz --in-intensity-name norm --in-intensity-units MR --subject $subject --surf-wm-vol --ctab $FREESURFER_HOME/WMParcStatsLUT.txt --etiv"
929+
else
930+
# calculate brainvol stats and aseg stats with segstats.py
931+
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/segstats.py" --sid "$subject"
932+
--segfile "$mdir/aseg.mgz" --segstatsfile "$statsdir/aseg.stats"
933+
--pvfile "$mdir/norm.mgz" --normfile "$mdir/norm.mgz" --threads "$threads"
934+
# --excl-ctxgmwm: exclude Left/Right WM / Cortex despite ASegStatsLUT.txt
935+
--excludeid 0 2 3 41 42
936+
--lut "$FREESURFER_HOME/ASegStatsLUT.txt" --empty
937+
measures --compute "BrainSeg" "BrainSegNotVent" "VentricleChoroidVol"
938+
"lhCortex" "rhCortex" "Cortex" "lhCerebralWhiteMatter"
939+
"rhCerebralWhiteMatter" "CerebralWhiteMatter"
940+
"SubCortGray" "TotalGray" "SupraTentorial"
941+
"SupraTentorialNotVent" "Mask($mdir/mask.mgz)"
942+
"BrainSegVol-to-eTIV" "MaskVol-to-eTIV" "lhSurfaceHoles"
943+
"rhSurfaceHoles" "SurfaceHoles"
944+
"EstimatedTotalIntraCranialVol")
945+
RunIt "$(echo_quoted "${cmd[@]}")" "$LF"
946+
echo "Extract the brainvol stats section from segstats output." | tee -a "$LF"
947+
# ... so stats/brainvol.stats also exists (but it is slightly different
948+
# cmd="recon-all -subject $subject -segstats $hiresflag $fsthreads"
949+
# RunIt "$cmd" "$LF"
950+
951+
# this call is only "required" to "compute" brainvol.stats, so --normfile/--pvfile
952+
# are not required
953+
cmd=($python "$FASTSURFER_HOME/FastSurferCNN/segstats.py" --sid "$subject"
954+
--segfile "$mdir/aseg.mgz" --pvfile "$mdir/norm.mgz"
955+
--measure_only --threads "$threads" --segstatsfile "$statsdir/brainvol.stats"
956+
measures --file "$statsdir/aseg.stats"
957+
--import "BrainSeg" "BrainSegNotVent" "SupraTentorial"
958+
"SupraTentorialNotVent" "SubCortGray" "lhCortex" "rhCortex"
959+
"Cortex" "TotalGray" "lhCerebralWhiteMatter"
960+
"rhCerebralWhiteMatter" "CerebralWhiteMatter" "Mask"
961+
--compute "SupraTentorialNotVentVox" "BrainSegNotVentSurf"
962+
"VentricleChoroidVol")
966963
fi
964+
RunIt "$(echo_quoted "${cmd[@]}")" "$LF"
965+
967966

968967
# ============================= MAPPED-WMPARC =========================================
969968
{

0 commit comments

Comments
 (0)