A guide to quantifying head motion in DTI studies

Monday, November 30, 2015 Do Tromp 3 Comments

Different modality, same problem; Axial FLAIR images of the brain obtained before (A) and after (B) application of a real-time motion-correction algorithm. (MGH)

It is unfortunately not common practice in diffusion imaging research to report on observed head motion of the participants in the scanner. Even though head motion can significantly influence study results (see also Yendiki et al., 2014). A recent publication by Weinberger and Radulescu (2015) reiterated the importance of controlling for unintended covariates in neuroimaging research, they note that:

"The widespread use of MRI has led to a wealth of structural and functional anatomical findings in patients with diverse psychiatric disorders that may represent insights into pathobiology. However, recent technical reports indicate that data from popular MRI research—particularly structural MRI, resting-state functional MRI, and diffusion tensor imaging—are highly sensitive to common artifacts (e.g., head motion and breathing effects) that may dominate the results. Because these and other important confounders of MRI data (e.g., smoking, body weight, metabolic variations, medical comorbidities, psychoactive drugs, alcohol use, mental state) tend to vary systematically between patient and control groups, the evidence that findings are neurobiologically meaningful is inconclusive and may represent artifacts or epiphenomena of uncertain value. The authors caution that uncritically accepting from study to study findings that may represent fallacies of all sorts carries the risk of misinforming practitioners and patients about biological abnormalities underlying psychiatric illness." - AJP 2015
One of the main artifacts mentioned is head motion, and although it is not commonly reported in DTI studies, it is possible to quantify this variable and test group differences. This guide should help you in this process and hopefully incentivize DTI studies to report on this nuisance variable. 

After running motion and eddy correction using FSL's eddy_correct tool, you can extract how much the data had to be moved to counter head motion using the .ecclog output. Mark Jenkinson wrote some code to extract these values, and posted it on the FSL mail list, you can find his post here and copy his code.
In order to run that code for a group of subjects you can use the wrapper code below. The output will be text and image files with the displacement, rotation and translation information for each subject.
echo ~~~Export displacement, rotation and translation for each subject~~~
for i in `ls *.ecclog`
prefix=`echo $i | awk 'BEGIN{FS=".ecclog"}{print $1}'`
ec_plot.sh ${i}
mv ec_disp.txt ${prefix}_ec_disp.txt
mv ec_disp.png ${prefix}_ec_disp.png
mv ec_rot.txt ${prefix}_ec_rot.txt
mv ec_rot.png ${prefix}_ec_rot.png
mv ec_trans.txt ${prefix}_ec_trans.txt
mv ec_trans.png ${prefix}_ec_trans.png
The ec_disp files contain the eddy current estimated mean displacement (mm). The ec_rot files contain the eddy current estimated rotations (radians). And the ec_trans files contain the eddy current estimated translations (mm). In order to calculate the euclidian distance from these rotations for each subject I wrote the below code:

Echo ~~~Extract absolute translation average (mm) and euclidian distance~~~
for i in `ls *_ec_trans.txt`;
prefix=`echo $i | awk 'BEGIN{FS="_ec_trans"}{print $1}'`
count=`cat $i| wc |awk '{ print $1}'`
#Translation for x
x_total=`cat $i |tr -d - |awk '{s+=$1} END {print s}'`
x_average=`echo "scale=4; $x_total / $count" | bc`
#Translation for y
y_total=`cat $i |tr -d - |awk '{s+=$2} END {print s}'`
y_average=`echo "scale=4; $y_total / $count" | bc`
#Translation for z
z_total=`cat $i |tr -d - |awk '{s+=$3} END {print s}'`
z_average=`echo "scale=4; $z_total / $count" | bc`
#euclidian distance
euclidian=$(echo "scale=4;sqrt(($x_average*$x_average)+($y_average*$y_average)+($z_average*$z_average))" | bc)

echo ${prefix}, ${x_average}, ${y_average}, ${z_average}, ${euclidian} >> movement_data.txt
echo ${prefix}, ${x_average}, ${y_average}, ${z_average}, ${euclidian}
This code takes the absolute value of the x, y and z translation and calculates the average for each, and then uses these values to calculate total euclidian distance per subject. The output will be dumped on the screen and written to movement_data.txt. Once you have these data, you can calculate if there is a significant group difference in movement parameters. So you can report this data in your work.

Reference this post as: Do Tromp, A guide to quantifying head motion in DTI studies,The Winnower 3:e146228.88496 (2016). DOI:10.15200/winn.146228.88496