A set of matlab scripts for diffusion analysis after data preprocessing (e.g., using the HCP preprocessing pipeline).
These matlab scripts basically call functions provided by other diffusion analysis toolkits, especially those provided by fsl (https://fsl.fmrib.ox.ac.uk/fsl/fslwiki) and mrtrix3 (https://www.mrtrix.org/). So please make sure those toolkits are also installed on your computer. You may also need to set environment variables to include paths to fsl and mrtrix3 functions, and to python (which is used by mrtrix3), for example, by adding the following lines in your .cshrc file:
setenv FSLDIR /opt/local/fsl-5.0.9/fsl
source ${FSLDIR}/etc/fslconf/fsl.csh > /dev/null
setenv MRTRIX_HOME /opt/local/mrtrix3.20180307
setenv PATH ${FSLDIR}/bin:${MRTRIX_HOME}/bin:${PATH}
setenv PYTHON_HOME /opt/local/python-3.6
setenv PATH ${PYTHON_HOME}/bin:${PATH}
setenv LD_LIBRARY_PATH ${PYTHON_HOME}/lib/python3.6:${LD_LIBRARY_PATH}
These matlab scripts have been used to analyse diffusion data for this paper: Wu, X., et al. (2018). "High-resolution whole-brain diffusion MRI at 7T using radiofrequency parallel transmission." Magnetic Resonance in Medicine 80(5): 1857-1870. And for this ISMRM abstract Wu, X., et al. (2019). Submillimeter whole brain diffusion MRI at 7 Tesla using simultaneous multislice imaging. In Proceedings of the 27th Annual Meeting of ISMRM, Montreal, Quebec, Canada. p1049. And most recently for this paper: X. Ma, K. Uğurbil, and X. Wu, Denoise magnitude diffusion magnetic resonance images via variance-stabilizing transformation and optimal singular-value manipulation. NeuroImage, 2020. 215: p. 116852. https://doi.org/10.1016/j.neuroimage.2020.116852
Scripts that are of most interest are briefly described as follows:
-
prep4dataAnalysis.m: prepare for data analysis by layouting folder trees. You should always run this script first, before running any other.
-
dtifitBatch.m: batch the use of fsl
dtifit, for diffusion tensor imaging. -
sseAverage.m: evaluate region-specific average values for certain diffusion metrics obtained by running fsl
dtifit, such as 1) whole brain average SSE (sum of squared errors) excluding CSF; 2) average mean diffusivity for CSF. -
bedpostxBatch.m: batch the use of fsl
bedpostX, for fitting the advanced ball and stick diffusion model. -
dataAnalysis.m: analyze the output from running bedpostxBatch.m to e.g. calculate average volume fraction and average dispersion etc and to create a mask for each fiber population by thresholding the corresponding volume fraction map.
-
mrtrixBatch.m: batch a pipeline that uses mrtrix3 tools for a variety of diffusion analyses, ranging from diffusion tensor imaging, to estimation of fiber orientation distribution, to creation of fixel, to reconstruction of whole brain tractograms.
-
SC_mrtrixBatch.m: batch a pipeline using mrtrix3 tools for creating structural connectome based on a whole brain tractogram (eg, one reconstructed with mrtrixBatch.m) and a atlas. This script can also be used to create region-specific tractograms.
-
metricComparison.m: compare diffusion metrics derived using different methods (eg, original vs denoised vs reference) by creating correlation and Bland-Altman (BA) plots (https://www.mathworks.com/matlabcentral/fileexchange/45049-bland-altman-and-correlation-plot). Further, grouped bar charts with error bar summarizing the results of BA analysis are also created using a matlab tool
errorbar_groups. All figures plotted are automatically saved in a high quality format using theexport_figtoolbox which can be downloaded at https://github.com/altmany/export_fig. -
differenceMapping.m: compare diffusion metrics derived using different methods (eg, original vs denoised vs reference) by calculating difference maps (such as angular error for the principal eigenvector of diffusion tensor). The results are saved in nifti files for visualization in fsleyes etc.
-
snrEst.m: estimate average signal to noise ratio (SNR) values given the timeseries and noise estimation. The average SNR is calculated as follows. First, the mean image is calculated by averaging the timeseries (eg, that of a certain b-value). Second, the SNR map is calculated by taking the ratio of the mean image divided by the estimated noise map (eg, using the VST method). Third, the average SNR value is determined by locating the second peak in the histogram of the SNR map (which is observed to have two hills with the first hill corresponding to the Rician noise floor and the second to tissue SNR values).