ISMRM 2015 "Analyze This" data and examples

1.  Install Camino and get the data

1.1  Camino installation

Install the latest Camino and allocate plenty of RAM, since the example data set is quite large. Around 6Gb should be sufficient. Also, create a directory caminoProc to store results.

CAMINO_HEAP_SIZE=6000
mkdir caminoProc

1.2  Example data

The example data set comes from the Human Connectome Project. To obtain the data, register with ConnectomeDB. Then log in and choose "Single Subject" from the "WU-Minn HCP Data 500 Subjects + MEG2" data set.

At the next screen, press the "Download Images" button and select the preprocessed structural and diffusion data. You should get 100307_3T_Structural_preproc.zip and 100307_3T_Diffusion_preproc.zip. Unzip these archives where you want to do the processing.

2.  Create a master scheme file

fsl2scheme -bvecs 100307/T1w/Diffusion/bvecs -bvals 100307/T1w/Diffusion/bvals -bscale 1 \
-outputfile caminoProc/hcp.scheme

The imaging scheme contains measurements at b=5, b=1000, b=2000, and b=3000 s / mm^2.

3.  Subsetting the data

By selecting a subset of the measurements, we can reduce processing time and memory requirements. Also, the high b-value shells aren't optimal for estimating the diffusion tensor. So we'll select data from the b=5 and b=1000 shells, which is still higher angular resolution than most DTI (90 directions).

If you have sufficient RAM, you can load the whole data set and extract a subset:

selectshells -inputfile 100307/T1w/Diffusion/data.nii.gz -schemefile caminoProc/hcp.scheme -maxbval 1500 \
-outputroot caminoProc/hcp_b0_b1000 

Alternatively, you can split the full data into 3D volumes and stream them. This is slower but uses less memory.

split4dnii -inputfile 100307/T1w/Diffusion/data.nii.gz -outputroot caminoProc/dwi3D/dwi_

ls caminoProc/dwi3D > caminoProc/dwiImageList.txt

image2voxel -imagelist caminoProc/dwiImageList.txt -imageprefix caminoProc/dwi3D/ \
-outputfile caminoProc/allDWI.Bfloat

selectshells -inputfile caminoProc/allDWI.Bfloat -schemefile caminoProc/hcp.scheme -maxbval 1500 \
-outputroot caminoProc/hcp_b5_b1000

This will produce hcp_b5_b1000.Bfloat and hcp_b5_b1000.scheme, which you can use for linear DT fitting and tractography.

4.  Scheme file for nonlinear optimization

Nonlinear optimization in Camino, such as RESTORE, multi-tensor fitting, and compartment models, use normalized diffusion data, scaled such that an unweighted measurement in a voxel has magnitude 1.0. This is computed internally but requires the scheme to have measurements at b=0. The Camino team are working to fix this, in the mean time, it is necessary to edit the scheme file. To use the example data with nonlinear model fitting, set the b=5 measurements to b=0 in the scheme file.

5.  Linear DT fit

wdtfit caminoProc/hcp_b5_b1000.Bfloat caminoProc/hcp_b5_b1000.scheme \
-brainmask 100307/T1w/Diffusion/nodif_brain_mask.nii.gz -outputfile caminoProc/wdt.Bdouble

dt2nii -inputfile caminoProc/wdt.Bdouble -header 100307/T1w/Diffusion/nodif_brain_mask.nii.gz \
-outputroot caminoProc/wdt_

fa -inputfile caminoProc/wdt_dt.nii.gz -outputfile caminoProc/wdt_fa.nii.gz
md -inputfile caminoProc/wdt_dt.nii.gz -outputfile caminoProc/wdt_md.nii.gz

dteig -inputfile caminoProc/wdt.Bdouble -outputfile caminoProc/wdt_eig.Bdouble

6.  RESTORE

RESTORE requires normalized data so we use the modified scheme file hcp_b0_b1000.scheme here. The third value passed to restore is an estimate of the noise standard deviation sigma in the b=0 (actually b=5) data - Camino can estimate this from a homogenous ROI using estimatesnr. This provides a reasonable starting point for evaluating RESTORE, but we recommend looking at the output and adjusting sigma to balance robustness to outliers vs overfitting and throwing away too much data.

estimatesnr -inputfile caminoProc/hcp_b5_b1000.Bfloat -schemefile caminoProc/hcp_b0_b1000.scheme \
-brainmask caminoProc/cc.nii.gz

restore caminoProc/hcp_b5_b1000.Bfloat caminoProc/hcp_b0_b1000.scheme 200 \
-brainmask 100307/T1w/Diffusion/nodif_brain_mask.nii.gz -outputfile caminoProc/restoredt.Bdouble

7.  Deterministic tractography

A seed image is required for tracking. The image wmMask.nii.gz in the presentation was made by extracting the white matter labels from the FreeSurfer segmentation in 100307/T1w/aparc+aseg.nii.gz, resampled into DTI space. The waypoint image cc.nii.gz was drawn manually in ITK-SNAP.

track -inputmodel dt -inputfile caminoProc/wdt_dt.nii.gz -seedfile caminoProc/wmMask.nii.gz -anisthresh 0.01 \
-curvethresh 70 -outputfile caminoProc/allTracts.Bfloat

procstreamlines -inputfile caminoProc/allTracts.Bfloat -waypointfile caminoProc/cc.nii.gz  \
-outputfile caminoProc/ccTracts.Bfloat

8.  Bayesian tracking

A manual seed cst_seed.nii.gz was drawn for the presentation. The second command here produces a streamline density image.

track -inputmodel bayesdirac_dt -inputfile caminoProc/hcp_b5_b1000.Bfloat \
-schemefile caminoProc/hcp_b5_b1000.scheme  -seedfile caminoProc/cst_seed.nii.gz \
-brainmask 100307/T1w/Diffusion/nodif_brain_mask.nii.gz -curvethresh 70 -pointset 0 \
-iterations 1000 -outputfile caminoProc/cstBayesTracts.Bfloat

procstreamlines -inputfile caminoProc/cstBayesTracts.Bfloat -seedfile caminoProc/cst_seed.nii.gz \
-outputacm -outputroot caminoProc/cstBayes_

9.  Connectivity matrix

conmat produces a CSV file of streamline counts connecting ROIs, and optionally scalar statistics such as the mean FA along those lines. The cortical ROIs in corticalLabels.nii.gz were extracted from 100307/T1w/aparc+aseg.nii.gz and resampled into the DTI space. The label names corticalLabels.csv come from the FreeSurfer Color LUT.

procstreamlines -inputfile caminoProc/ccTracts.Bfloat -endpointfile caminoProc/corticalLabels.nii.gz  \
-outputfile caminoProc/ccCortexTracts.Bfloat

conmat -inputfile caminoProc/ccCortexTracts.Bfloat -targetfile caminoProc/corticalLabels.nii.gz \
-targetnamefile caminoProc/corticalLabels.csv -outputroot caminoProc/conmat_