There is a inbuilt capability to process diffusion files as a whole cohort within a study in MRtrix. This process is proposed by (https://doi.org/10.1016/j.neuroimage.2016.09.029). The fixel pipeline requires more user input, is more computationally expensive and not as well streamlined as the advanced diffusion pipeline. However, as it is generally used for particular study-specific outcomes and may not be applicable in many circumstances, this is unlikely to change soon.
These scripts are called, in order:
-
intensnormandrespfx -
upsampleandfods -
fodtemplateandfixelmask -
fodmodulationandfdcalc -
fixeltracksgen -
fixeltfcestats
- The first script to run is
intensnormandrespfx. This is done in the same way asadvfulldiffsetup, with one major difference:dticonis no longer used:fixelconis used instead. This script automatically generates the files when given the proper commands:
$ cd ~/diffusion-pipeline/fixelanalysis
$ sh fixelcon /working/your_lab_here/your_working_dir/ intensnormandrespfx AFD
$ cd /working/your_lab_here/your_working_dir/
$ cd fixelbatch
$ qsub fixel_intensnormandrespfx.sh
Note that there is only one script generated by this command, as fixel-based analysis is performed on the entire cohort, generally to compare patients to controls or correlating with functional scores, demographics or other subject-specific data unrelated to diffusion.
intensnormandrespfx normalises the entire cohort and computes the average response in WM and CSF. There are several files created for each subject, which can be found in the main outdir AFD. Normalised DWIs are placed in the DWInorm directory, normalised masks are placed in the Masks directory, while fa_template.mif and fa_template_wm_mask.mif are created as well. Diffusion tensors are calculated from each normalised subject DWIs, along with FA and MD.
Average response functions for WM and CSF are calculated from the response functions of each subject. Multi-shell multi-tissue CSD is performed, producing WM and CSF FODs for each subject that has been normalised to the average response function (found in AFD/FODS).
upsampleandfodsis run next. This upsamples both the DWIs and FODs, as well as the subject brain masks. This is run similar tointensnormandrespfx, aside from the voxel size, as this needs to be set manually. According to http://mrtrix.readthedocs.io/en/latest/fixel_based_analysis/mt_fibre_density_cross-section.html#upsampling-dw-images, an isotropic voxel size of 1.3 mm is a good choice. If your acquisition has a smaller voxel size, you can skip this step.
$ cd ~/diffusion-pipeline/fixelanalysis
$ sh fixelcon /working/your_lab_here/your_working_dir/ upsampleandfods AFD 1.3 #this is our voxel size here
$ cd /working/your_lab_here/your_working_dir/
$ cd fixelbatch
$ qsub fixel_upsampleandfods.sh
This script places the newly upsampled files in AFD/upsample in your main working directory.
fodtemplateandfixelmaskprovides an unbiased study-specific FOD template. Generally, this step is the most time-consuming step in the pipeline. Again, this script is called as above (make sure that voxel size is set in the script call):
$ sh fixelcon /working/your_lab_here/your_working_dir/ fodtemplateandfixelmask AFD 1.3
All files can be found in the AFD/fodtemplate folder. This process produces the file fod_template.mif and warps the template to each subject's FOD and mask, while each subject is warped as well. This also produces a population mask mask_intersection.mif, and an image based on the FOD peaks is generated fixeltemp/peaks.mif. peaks.mif is then thresholded to produce a mask fixeltemp/mask.mif in fixel space while a median-filtered voxel mask voxel_mask.mif is created from mask.mif as well.
voxel_mask.mif is then passed to a command that segments the FOD template to produce a fixel mask fixel_mask. Note that all fixel images are stored in directory-format (i.e. a folder).
Population templates are generally optimally run for ~40 subjects. If you have more subjects than this, you will need to run the following command to select for a limited subset of subjects. Assuming your directories are labelled groupwise:
foreach `ls -d *patient | sort -R | tail -20` : ln -sr DWInorm/UNI_wm.mif fodtemplate/PRE.mif ";" ln -sr upsample/Masks/UNI_Mask.mif fodtemplate/PRE_Mask.mif
foreach `ls -d *control | sort -R | tail -20` : ln -sr DWInorm/UNI_wm.mif fodtemplate/PRE.mif ";" ln -sr upsample/Masks/UNI_Mask.mif fodtemplate/PRE_Mask.mif
Following this, to warp remaining subjects into template space:
dwi2tensor upsample/<subj>_DWI.mif -mask upsample/<subj>_Mask.mif - | tensor2metric - -fa - | mrregister fa_template.mif - -mask2 upsample/<subj>_Mask.mif -nl_scale 0.5,0.75,1.0 -nl_niter 5,5,15 -nl_warp - warps/<subj>2template.mif | mrtransform fixeltemp/mask.mif -template upsample/<subj>_DWI.mif -warp - - | dwinormalise upsample/<subj>_DWI.mif - upsample/<subj>_DWInorm.mif
You may also perform the above step if you are acquiring data in a staggered way. You will need to process new subjects as they come in to this stage as well (making sure that you have normalised and upsampled your DWI and mask files).
fodmodulationandfdcalcthis script firstly warps all subject WM FODs to template space, then segments FOD images to estimate fixels and apparent fibre density (FD), and then finally sets up the structure for the statistical analysis. Again, call it like before:
$ sh fixelcon /working/your_lab_here/your_working_dir/ fodmodulationandfdcalc AFD
All files can be found in AFD/fodtemplate/fixels. Each subject WM FOD is warped to template space (found in intemplatespace), then their FD is calculated fd.mif. Reorientation of the fixels of each subject in template space is performed, based on the local transformation at each voxel in the warps used previously. Subject fixels are assigned to template fixels (found in fd folder). Fibre cross-section metric (FC) is mapped directly by using the warps (see https://doi.org/10.1016/j.neuroimage.2016.09.029 for more info) (found in fc folder). Finally, fibre density and cross-section (FDC) is calculated by combining the two previous metrics (multiplication).
Each fixel direction and index file (directions.mif and index.mif, respectively) are found in the folder corresponding to each metric (FD, FC and FDC).
fixeltracksgengenerates the streamlines (and SIFTs them as well) for use in deriving the local connectivity information as described in https://doi.org/10.1016/j.neuroimage.2015.05.039.
$ sh fixelcon /working/your_lab_here/your_working_dir/ fixeltracksgen AFD
These files are found in AFD/fodtemplate/ known as tracks_20_million_defang.tck and tracks_2_million_defang_sift.tck.
fixeltfcestatsis only to be used (along with the whole pipeline, more generally) if there is a study-specific reason to compute statistics that involve higher order methods of quantification of tract connectivity (e.g. relationship of fibre connectivity in subject to behavioural measures). To use this script, you will need to create a design matrix (i.e. GLM) that describes your subject differences. If this is a simple patient-control contrast, place