Creating Brain Connectome

Greetings all,

I’m hoping you can help me out here. I’m working on a dataset of ex-vivo mouse brains and am trying to optimize my MR-diffusion protocol for fiber tracking and connectome construction in mouse brain. This is the first time for me to use MRtrix and I just want to check if am doing it the right way or do I need to change something.

The commands am using are the followings:
#1 denoinsing the data using the command dwidenoise.

#2 extracting the b0 images to creat a mask using itksnap:
dwiextract dwi-denoised.nii -no_bzero -grad gradient.txt - | mrmath - mean dwi_mean.nii -axis 3

#3 Then I create a mask and apply it.

#4 calculating the bias in b zero images and b zero mean across time using FSL:
fslselectvols -i dwi-denoised-masked.nii.gz --vols=0,1,2 -o dwi-denoised-masked-B0.nii.gz
fslmaths dwi-denoised-masked-B0.nii.gz -Tmean B0-mean.nii.gz

#5 calculate and apply bias field correction using ANTs:
N4BiasFieldCorrection -d 3 -i B0-mean.nii.gz -x mask.nii -o [B0-corrected.nii,bias.nii] -v
fslmaths dwi-denoised-masked.nii.gz -div bias.nii N4.nii

#6 calculating the response function using tournier algorithm since am using single shell.
dwi2response tournier N4.nii.gz response.text -grad gradient.txt -mask mask.nii

#7 calculating FOD:
dwi2fod csd -mask mask.nii -grad gradient.txt N4.nii.gz response.text fod.nii.gz

#8 Generating tracts for given ROIs that covers all brain regions excluding inter-hemispheric connection (referred to as 100.nii):
tckgen -seed_random_per_voxel mask.nii 10 fod.nii Tracks.tck -exclude 100.nii

#9 convert my ROIs datatype to uint32 as recommended by MRtrix so I can generate the connectome:
mrconvert -datatype uint32 labels.nii.gz labels-ui32.nii.gz

#10 Generating the connectome:
tck2connectome Tracks.tck labels-ui32.nii.gz -assignment_all_voxels -out_assignments path_list -zero_diagonal -symmetric connectome.csv

Forgive my poor knowledge as am totally knew in this field. Thanks in advanced.

Welcome Majd!

It’s difficult to judge a complete pipeline based on hypothetical data, it will require a certain degree of critical assessment at each step to see whether or not there are any implicit assumptions or optimisations or the like that aren’t quite doing what they should for your data.

Nevertheless:

#1 denoinsing the data using the command dwidenoise.
#2 extracting the b0 images to creat a mask using itksnap:

mrdegibbs is generally recommended in between here; though its applicability will depend on whether or not any k-space manipulations have been applied to your data by the scanner.

#3 Then I create a mask and apply it.

I would generally advocate using a mask for certain applications, but not applying it (which I’m inferring here to have been multiplicatively applied to your DWI data). You can elect to constrain any particular step using a mask; but once you’ve multiplied your raw data by a mask, you can never elect for that mask to not be applied to any subsequent step.

#4 calculating the bias in b zero images and b zero mean across time using FSL:
fslselectvols -i dwi-denoised-masked.nii.gz --vols=0,1,2 -o dwi-denoised-masked-B0.nii.gz
fslmaths dwi-denoised-masked-B0.nii.gz -Tmean B0-mean.nii.gz

#5 calculate and apply bias field correction using ANTs:
N4BiasFieldCorrection -d 3 -i B0-mean.nii.gz -x mask.nii -o [B0-corrected.nii,bias.nii] -v fslmaths dwi-denoised-masked.nii.gz -div bias.nii N4.nii

This can all be done in one line using dwibiascorreect ants. Note that for rodent data, the parameters to N4 may need to be tweaked, as I think the defaults are based on mm and not voxel size.

#7 calculating FOD:
dwi2fod csd -mask mask.nii -grad gradient.txt N4.nii.gz response.text fod.nii.gz

Even for single-shell data, using the msmt_csd algorithm can be preferable. Firstly, it applies a hard rather than soft non-negativity constraint. Secondly, if you can get a free-fluid response function by using dwi2response dhollander, you can fit two “tissues” in this step due to the availability of two unique b-values (one being your b=0 data), yielding some free water signal suppression in your FODs.

#9 convert my ROIs datatype to uint32 as recommended by MRtrix so I can generate the connectome:
mrconvert -datatype uint32 labels.nii.gz labels-ui32.nii.gz

Not strictly a requisite step; but if the parcels are in any other datatype, any command that reads a parcellation image will need to do an up-front check to make sure that the data could be represented using unsigned integers.

#10 Generating the connectome:
tck2connectome Tracks.tck labels-ui32.nii.gz -assignment_all_voxels -out_assignments path_list -zero_diagonal -symmetric connectome.csv

The “all voxel” assignment mechanism is principally there for demonstrative purposes, not so much so for genuine application. If your ROIs happen to be intended to refer to WM rather than GM regions, then it’s wholly appropriate, since then one would expect one streamline to be able to intersect more than two WM regions, and for the observation of such to not be indicative of an error / bias / limitation. However if your parcels are intended to refer to GM regions, then having individual streamlines being assigned to more than two GM regions does not make a great deal of sense. See figures explaining how this works in this manuscript.

#8 Generating tracts for given ROIs that covers all brain regions excluding inter-hemispheric connection
#10 Generating the connectome:

Generally in between these steps I would be advocating for the use of SIFT or SIFT2; but if it is your specific intention to investigate streamline count only, that’s fine.

Cheers
Rob