Skip to content

Extracting Grey Matter, White Matter, and CSF volume measures from CIVET

gerjur edited this page Mar 1, 2018 · 3 revisions

If you wish to obtain a CSV file with each subject's total grey matter, total white matter, and total cerebrospinal fluid (CSF) volume based on the CIVET classifications, then this tutorial is for you.

Once your CIVET run has completed,go into your output folder and run this:

for file in */classify/*cls_volumes.dat
do
echo $(dirname $(dirname $file)),$(cat $file | tr -s ' ' | cut -f 3 -d" " | sed -n 1p),$(cat $file | tr -s ' ' | cut -f3 -d" "| sed -n 2p),$(cat $file | tr -s ' '| cut -d " " -f 3| sed -n 3p)
done > gmwmcsfvolumes.csv

for CIVET2.1 (4 tissue classes, CSF (1), cortical GM (2), WM (3), subcortical GM (4)):

for file in */classify/*cls_volumes.dat
do
echo $(dirname $(dirname $file)),$(cat $file | tr -s ' ' | cut -f 3 -d" " | sed -n 1p),$(cat $file | tr -s ' ' | cut -f3 -d" "| sed -n 2p),$(cat $file | tr -s ' '| cut -d " " -f 3| sed -n 3p),$(cat $file | tr -s ' '| cut -d " " -f 3| sed -n 4p)
done > csfgmwm_subcGMvolumes.csv
Clone this wiki locally