eddy quad and MRTrixcode written: 2020-01-04
last ran: 2020-01-17
website: http://rpubs.com/navona/SPINS_DWI_QCautomated
Description. This script summarizes key QC metrics from the automated eddy QC tools, i.e., the eddy quad PDFs (Bastiani et al., NeuroImage, 2019), and MRTrix for the n=422 participants who are eligible for inclusion in my thesis analysis (see CONSORT-style diagram).
Thresholds for key eddy QC metrics. Our DWI working group suggested thresholds for key QC metrics, on the basis of analysis of subsets of the SPINS, POND, and HCP datasets. These thresholds were found to reliably predict a number of different visual QC ratings from different raters. The suggested thresholds were as follows:
| Metric | Absolution motion | Relative motion | Percent outliers | Average SNR | Average CNR | Residual noise |
| Suggested threshold | >= 2 (mm) | >= .5 (mm) | >= 2 (%) | <= 20 | <= 1.5 | >= 6 |
Visualizations of SPINS data quality. The distributions of the key QC metrics for the SPINS sample in my thesis analysis are visualized in the tabs below. The suggested thresholds are marked by the dashed vertical line. Participants with values exceeding the suggested thresholds are indicated by participant ID.
#write a function for plotting automated QC metrics
eddyPlot_fn <- function(yvar, threshold, operator){
#fancy fanagling to use variable and operator in ggplot
yvar <- eval(substitute(yvar), df)
operator_fn <- match.fun(operator)
#feed data into ggplot
df %>% ggplot(aes(x=factor(0), y = get(yvar))) +
#add jittered points
geom_jitter(aes(fill=site), width=.5, alpha=.4, size=5, pch=21) +
scale_fill_manual(values=c('#d53628','#9a4a55','#448ba1','#8baea7','#c99b2c','#e5bd31')) +
#overlay violin plot
geom_violin(trim = FALSE, fill='lightgrey', color='black', alpha=.2, color = NA) +
#specify plot appearance
coord_flip() +
theme_classic() +
ylab('') +
xlab('') +
theme(legend.position='none',
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.line=element_blank()) +
#add cut-off score line
geom_hline(yintercept = threshold, linetype = "dashed", color = "black") +
#add a label to outliers
geom_label_repel(data = subset(df, operator_fn(get(yvar), threshold)),
aes(label = record_id), segment.colour = 'black', nudge_x =.2)
}
Potential participant exclusion. The DWI working group recommended that participants exceeding threshold on 2 or more QC metrics should be removed from subsequent analyses. (Participants not exceeding this threshold will still undergo visual/non-automatic quality control and possibility be excluded for similar or unrelated reasons in that process.) If this decision were applied here, we would omit n=422 participants from my thesis analysis, as follows:
| Participant | Group | Site | Absolute motion | Relative motion | Percent outliers | Average SNR | Average CNR | Residual noise | Flag count |
|---|---|---|---|---|---|---|---|---|---|
| SPN01_CMH_0050 | SSD | CMH | 2.04 | 1.5 | 5.45 | 16.49 | 1.01 | 3.31 | 5 |
| SPN01_MRC_0044 | SSD | MRC | 1.74 | 1.55 | 2.57 | 19.43 | 1.4 | 0.71 | 4 |
| SPN01_MRC_0049 | SSD | MRC | 1.59 | 0.76 | 0.16 | 17.9 | 0.51 | 1.58 | 3 |
| SPN01_MRC_0058 | HC | MRC | 9.33 | 0.86 | 0.51 | 16.97 | 0.96 | 0.57 | 4 |
| SPN01_MRP_0132 | SSD | MRP | 3.19 | 1.2 | 2 | 14.67 | 1.01 | 0.77 | 4 |
| SPN01_ZHH_0023 | HC | ZHH | 1.65 | 0.68 | 0.54 | 34.69 | 1.47 | 3.18 | 2 |
| SPN01_ZHH_0038 | SSD | ZHH | 1.89 | 0.91 | 3.85 | 32.46 | 1.5 | 2.77 | 3 |
| SPN01_ZHP_0088 | HC | ZHP | 0.7 | 0.15 | 1.17 | 18.48 | 1 | 0.62 | 2 |
| SPN01_ZHP_0091 | SSD | ZHP | 0.76 | 0.19 | 0.07 | 19.53 | 1.19 | 0.61 | 2 |
| SPN01_ZHP_0111 | SSD | ZHP | 2.43 | 0.46 | 1.15 | 10.99 | 1.74 | 0.92 | 2 |