# Wiki

Clone wiki# ACID - Artefact correction in diffusion MRI / TensorFitting Wiki

## Short introduction

The Tensor Fitting tool is an academic software to estimate the diffusion tensor. The methods available to estimate the tensor are: ordinary least squares, weighted least squares, and robust tensor fitting.

## Fit Diffusion tensor pre-processing

- Use EC and Motion Correction to correct for EC and motion artefacts. The EC and motion corrected images will have a prefix “r”.
- Define two variables in matlab, which cover the diffusion directions (3xN matrix) and b-values (1xN vector), before running the Fit Diffusion tensor toolbox. The “i-th” column (component) must correspond to the vector of the diffusion gradient (and the b-value) of the “i-th” image in the DTI dataset. If the b-value for the low-b-value images is unknown, type b=1, and if its diffusion gradient direction is unknown, type a random direction, which is normalised to 1.

## Use Tensor Fitting

**DTI images:**Load pre-processed DTI images. The order of images can be random, as long as the diffusion directions and b-values are loaded in the same order.**Diffusion directions:**Load the diffusion directions (3xN array) in the same order as the DTI images.**b-values:**Load the b-values (1xNvector) in the same order as the DTI images.**Reorient matrix:**A global matrix to reorient the diffusion vectors. This might be useful, if the diffusion gradients are defined in a different coordinate systems than the acquired images.**Region of interest image (or done for none):**This entry is optional. Note that if your had acquired HARDI data (and/or high-resolution data), it is recommened to provide a mask unless you believe that you have got enough memory!**Fitting algorithm:**Here you can choose between three tensor fitting algorithms:- Ordinary least squares: This method will deliver the highest SNR but is most sensitive to outliers.
- Weighted least squares: This method will (to some degree) account for the Rician noise distribution.
- Robust tensor fitting: This method will down-weight outliers and is most efficient for reducing the effect of outlier-related bias in dMRI data (see e.g. Mohammadi et al. (2013)).
**Fit Defaults**- Option to write all the estimated diffusion weighted images (DWI), i.e.low-b-value and high-b-value images. This option provides DWIs with reduced noise, but keep in mind that the modeled DWIs are limited by the DTI model used (here diffusion tensor model).
- Option to write all eigenvectors (by default the eigenvector with greatest eigenvalue as well as all eigenvalues are also written as an output).
- Option to write the diffusion tensor and the diffusion-weighted images in a format that can be read by the Freiburg DTI tools.
- Standard deviation of logarithm of the signal outside the brain. This measure is used as the SNR and affects the weighting of the signal.
- The confidence interval "C” changes the threshold above which outlier will be down-weighted (see Fig. 1). By increase C you became more sensitive to outliers but also increase the noise level in your tensor estimates. The used value for C has been recommended by previous studies (see e.g. Zwiers (2010)). Increasing it will decrease C, i.e. reduce the amount of data used and thus the signal-to-noise ration.
- “Smoothing the residuals”: This measure determines the width of a two-dimensional in-plane smoothing kernel which is applied on your residual map (i.e. root-mean-square of your tensor-fit error).
- "Sensitivity of the robust fitting": It is in the same order of magnitude as the diffusion tensor, i.e. in the order of 1/1000. It determines the cutoff level for the robust fitting iteration, i.e. what amount of variation in the estimated diffusion tensor will be tolerated.
- Option to write weights on a voxel-by-voxel basis for each diffusion-weighted image using the robust fitting algorithm (see Fig. 2). This will be stored as a 4D nifti, where the fourth dimension includes weights for each diffusion-weighted image.
- Option to display a summary plot of the weights during robust fitting. Can be instructive to get an idea about the data quality.

## Background

**Fig. 1**: The robust fitting model down-weights two types of outliers that fall far outside the expected normal distribution of residuals C (the so-called “confidence interval”): (a) Voxel-wise outliers are addressed with a term that changes from voxel-to-voxel (ωv). This measure is noisy; to reduce the noise the limits for the confidence interval C will be smoothed (see Defaults “smoothing the residuals”). (b) Signal-dropout within a whole slice (e.g. due to subject motion) is addressed with an additional term that only changes from slice-to-slice (ωs) and thus is less noisy.

The basic idea of the robust-fitting method is based on the paper of Zwiers (2010), where different types of weighting functions are combined using a Gaussian weighting scheme. Robust fitting is recommended if your data suffers from outliers, e.g. due to physiological noise (e.g. Mohammadi et al. (2013a)) or subject motion (e.g. Mohammadi et al. (2013)). It works well if your outliers are sparsely distributed along different diffusion directions (Zwiers (2010)) and you acquired enough data (N>30, where “N” is the number of images in the DTI sequence, Chang et al. (2005)). Note that if the amount of outliers is too high in a dMRI dataset, outlier-rejection might worsen the data quality instead of improving it. In our toolbox, we take care of this problem by checking the condition number of the diffusion-tensor design matrix, which down-weighting of individual data points. Note also that for data with low SNR (SNR < 4) the Gaussian noise distribution might be violated and the linear tensor fitting methods in this toolbox might not be valid anymore.

## Example in spinal cord DTI

**Fig. 2**: (a) The spinal cord consists of white and gray matter and is a very small structure that is about 1cm in diameter. (b) Furthermore it is subject to motion and distortion artifacts that vary between different time-points during measurement and thus can bias spinal cord DTI (see arrow). (c) Robust Fitting can help to decrease this bias (arrow) by rejecting data points that were classified as outliers by the weights in Figure 1. (c) The root-mean-square (rms) of the weights clearly highlights the region in white matter where outliers lead to a bias in the spinal cord FA (arrow). (d) The weights for each single image tell us something about the confidence that we have in the corresponding data point.

## Referencing

Mohammadi S, Freund P, Feiweier T, Curt A, Weiskopf N, The impact of post-processing on spinal cord diffusion tensor imaging, NeuroImage, Volume 70, 15 April 2013, Pages 377-385, doi: 10.1016/j.neuroimage.2012.12.058 .

(** Please cite this paper when using this tool**)

Updated