Beginner: Connectome pipeline (Updated)

Hi MRtrix Community,

Apologies in advance for a long post! I am a beginner MRTRIX user and I have spent a bit of time familiarising myself with this program. My primary objective is to have a workflow to go from DWI preprocessing to connectivity matrices using Freesurfer cortical segmentations to define the nodes.

I’d really appreciate it I could get some feedback/corrections on the basic workflow below (which has been written based on the tutorial), as well as some recommendations for the parameters wrt to tckgen.

T1: 1x1x1 mm3
DTI: 2x2x2 mm3

I hope this might also be helpful for other beginners learning how to construct the connectomes with MRtrix, and I will be attaching screenshots - of the same subject - for the various steps as I make progress.

Thank you all so much! :slight_smile:

A. DWI processing

  1. Process diffusion data
    dwipreproc -0 $i.nii $i.mif -rpe_none -fslgrad $i.bvec $i.bval

  2. Extract brain mask
    dwi2mask i.mif {i}_mask.mif

    In quite a number of my subjects, I see that some of the voxels are not included, especially in the posterior regions and some subcortical structures (i.e. figures below).

  3. Estimated response function
    dwi2response tournier i.mif {i}_response.txt

  4. FOD
    dwi2fod csd i.mif {i}_response.txt {i}_fod.mif -mask {i}_mask.mif

B. T1 Processing

  1. Process T1 in Freesurfer using standard recon-all

Result: aparc+aseg.nii.gz and T1.mgz

  1. Derive tissue-segmented image

5ttgen fsl T1.nii.gz 5TT.mif
QNs: Can I use Freesufer outputs here? Where does intra-individual DTI-T1 registration take place in this workflow?

  1. Visualise the multi-tissue image

5tt2vis 5TT.mif vis.mif; mrview vis.mif

  1. Modify the integer values in the parcellated image so that the numbers in the image corresponds to the rows and cols of the connectome

labelconvert aparc+aseg.nii.gz FreeSurferColorLUT.txt fs_default.txt nodes.mif
QN: This is assuming that I am using the Desikan atlas, right?

  1. Replace FreeSurfer’s estimates of sub-cortical grey matter structures with estimates from FSL’s FIRST tool

labelsgmfix nodes.mif T1.nii.gz fs_default.txt nodes_fixSGM.mif -premasked
QN: Why is this recommended in the tutorial?

C. Connectome generation

  1. Streamline tractography
    tckgen {i}_fod.mif {i}_tckgen.tck -seed_image {i}_mask.mif -mask {i}_mask.mif -number 1000000

  2. Perform SIFT

tcksift {i}_tckgen.tck {i}_fod.mif ${i}_SIFT.tck -act 5TT.mif -term_number 10M

  1. Map the streamlines to the parcellated T1 to produce the connectivity matrix

tck2connectome ${i}_SIFT.tck nodes_fixSGM.mif connectome.csv
QN: How can I extract other metrics for weighted networks such as the mean FA between 2 regions?

  1. View the connectome

mrview nodes_fixSGM.mif -connectome.init nodes_fixSGM.mif -connectome.load connectome.csv

  1. Load connectivity matrices in MATLAB for analyses with Brain Connectivity Toolbox
4 Likes

I may or may not have been writing an automated connectome generation pipeline this week… :ghost:

A few suggestions:

A. DWI processing

  • Run dwidenoise as your very first step. So far this appear to perform extremely well.

  • Run dwibiascorrect after dwipreproc. Getting rid of the B1 bias field will help with the brain masking, improve the tracking, and improve the SIFT results.

  • Dilate the brain mask and feed the dilated version to dwi2fod. Since ACT is responsible for terminating streamlines, you don’t want an erroneous DWI brain mask cutting into the brain and causing streamlines to terminate in WM; so dilating it beforehand just gives a bit of an error margin, given DWI brain masking can still be a little off at times. You could equally just run dwi2fod without a mask, and it’d just take a while longer.

B. T1 Processing

5ttgen fsl T1.nii.gz 5TT.mif
QNs: Can I use Freesufer outputs here? Where does intra-individual DTI-T1 registration take place in this workflow?

You can: simply use 5ttgen freesurfer instead of 5ttgen fsl. But have a close look at the resulting 5TT image to decide whether or not you actually want to use it…

labelconvert aparc+aseg.nii.gz FreeSurferColorLUT.txt fs_default.txt nodes.mif
QN: This is assuming that I am using the Desikan atlas, right?

The LUT file fs_default.txt is extracting the grey matter parcels from the aparc+aseg image, which is the Desikan-Killiany atlas. You can equivalently use LUT file fs_a2009s.txt to extract the grey matter parcels from the aparc.a2009s+aseg image, which would give you the Destrieux atlas, or design an appropriate LUT file to extract and order parcels from a custom cortical atlas. There’s supposed to be a documentation page explaining in more detail what this command is doing, but looks like it got lost during software updates; once I restore it it should appear here.

labelsgmfix nodes.mif T1.nii.gz fs_default.txt nodes_fixSGM.mif -premasked
QN: Why is this recommended in the tutorial?

Unfortunately this result got lost in supplementary material when it should have been appendix data… It’s associated with this paper. Basically you get reduced scan-rescan variability in your connectome, because the FIRST sub-cortical segmentations have less scan-rescan variability than the FreeSurfer ones.

C. Connectome generation

  • Your tckgen call isn’t using the ACT data in any way; so it’ll be tracking using the diffusion image data only. It’s also generally not necessary to use the -mask option in tckgen if using ACT.

  • You’re generating 1 million streamlines with tckgen, then asking tcksift to terminate when there are ‘only’ 10 million streamlines remaining. This is obviously not going to do as requested, since SIFT can only remove streamlines.

tck2connectome ${i}SIFT.tck nodesfixSGM.mif connectome.csv
QN: How can I extract other metrics for weighted networks such as the mean FA between 2 regions?

Check out the help page for the tck2connectome command; there’s a few mechanisms available for influencing this quantification. Specifically for calculating the mean FA between regions, take a look at this FAQ entry*.

*an updated FAQ article can be found in this wiki post

2 Likes

Hi Rob,

I will be extremely excited to learn about such a pipeline if you are indeed planning to implement it in future versions :slight_smile:

QN1) Do I use maksfilter to dilate the brain mask? Is there a general ACT recommendation for the -npass value?

QN2) For now, when I tried to run 5ttgen with FSL, I ran into the following error:

Command: mrconvert /Users/MacPro/Documents/NIMROD_Mrtrix/dlb_mrtrix/22995_T1.nii /tmp/5ttgen-tmp-3O4SZI/input.mif
5ttgen: Changing to temporary directory (/tmp/5ttgen-tmp-3O4SZI/)
Command: mrconvert input.mif T1.nii -stride -1,+2,+3
Command: maskfilter /usr/local/fsl/data/standard/MNI152_T1_1mm_brain_mask_dil.nii.gz dilate mni_mask.nii -npass 4
Command: standard_space_roi T1.nii T1_preBET.nii.gz -maskMASK mni_mask.nii -roiFOV
5ttgen: [WARNING] FSL command standard_space_roi appears to have failed; passing T1 directly to BET
Command: mrconvert input.mif T1_preBET.nii.gz -stride -1,+2,+3
Command: bet T1_preBET.nii.gz T1_BET.nii.gz -f 0.15 -R
Command: fast T1_BET.nii.gz
5ttgen:
5ttgen: [ERROR] Command failed: fast T1_BET.nii.gz
5ttgen: Output of failed command:
Image Exception : #22 :: ERROR: Could not open image T1_BET
terminate called after throwing an instance of ‘RBD_COMMON::BaseException’<

To investigate further, I tried to manually run standard_space_roi with the following command. Why is there an unrecognised option m?

    standard_space_roi 22995_T1.nii -maskMASK mni_mask.nii -roiFOV

    Unrecognised option m
    Lacking argument to option -maskMASK_tmp_to_std.mat
    Could not open matrix file -maskMASK_tmp_to_std_inv.mat
    terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
    /usr/local/fsl/bin/standard_space_roi: line 229: 68194 Abort trap: 6           ${FSLDIR}/bin/flirt -ref $in -in ${out}_tmp_standard_mask -o ${out}_tmp_standard_mask_to_in -applyxfm -init ${out}_tmp_to_std_inv.mat
    Cannot open volume -maskMASK_tmp_standard_mask_to_in for reading!
    Image Exception : #22 :: ERROR: Could not open image -maskMASK_tmp_standard_mask_to_in
    terminate called after throwing an instance of 'RBD_COMMON::BaseException'
    /usr/local/fsl/bin/standard_space_roi: line 229: 68197 Abort trap: 6           ${FSLDIR}/bin/fslmaths $inapply -mas ${out}_tmp_standard_mask_to_in ${out}_tmp_masked
    Could not open matrix file -maskMASK_tmp_to_std_inv.mat
    terminate called after throwing an instance of 'NEWMAT::IncompatibleDimensionsException'
    /usr/local/fsl/bin/standard_space_roi: line 242: 68199 Abort trap: 6           ${FSLDIR}/bin/flirt -ref $in -in ${out}_tmp_standard_roi -o ${out}_tmp_standard_roi_to_in -applyxfm -init ${out}_tmp_to_std_inv.mat
    Image Exception : #22 :: ERROR: Could not open image -maskMASK_tmp_standard_roi_to_in`indent preformatted text by 4 spaces`indent preformatted text by 4 spaces``

QN3 ) Regarding ACT, it is stated that T1 image should be rigidly registered to the DWI series before running 5ttgen and tckgen. I was wrongly under the impression that the registration was being done under the hood of tckgen. How can I do that with MRTrix? When I tried the following:

mrregister 22995_T1.mif 22995.mif (my DTI series) -type rigid
mrregister: [100%] preloading data for “22995_T1.mif”
mrregister: [100%] preloading data for “22995.mif”
mrregister: [ERROR] input images do not have the same number of dimensions


Image: “22995_T1.mif”


Dimensions: 176 x 240 x 256 x 1
Voxel size: 1 x 1 x 1 x 0
Data strides: [ -3 -1 -2 4 ]
Format: MRtrix
Data type: signed 16 bit integer (big endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9993 0.01697 -0.03344 -84.88
-0.006881 0.9596 0.2814 -128.6
0.03687 -0.281 0.959 -109.5
mrtrix_version: 0.3.15-179-g77ed15eb


Image: “22995.mif”


Dimensions: 96 x 96 x 63 x 64
Voxel size: 2 x 2 x 2 x 11.7
Data strides: [ -1 2 3 4 ]
Format: MRtrix
Data type: signed 16 bit integer (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9998 -0.02094 0.001451 -91.66
0.02078 0.9775 -0.2098 -93.95
0.002975 0.2098 0.9777 -53.58
comments: TE=106;sec=47865.0775;phaseDir=+;dwell=0.475
dw_scheme: [ 64 entries ]
mrtrix_version: 0.3.15-179-g77ed15eb

Thanks!

Do I use maskfilter to dilate the brain mask? Is there a general ACT recommendation for the -npass value?

Yep, that’s the command. No real rule for how many repeats; like I said, you could equally just not pass any mask at all to dwi2fod. The important point is that you don’t want streamlines erroneously terminating in the middle of WM because of an error in the DWI brain masking step.

For now, when I tried to run 5ttgen with FSL, I ran into the following error:

  • I don’t think I’ve ever figured out for certain why standard_space_roi sometimes fails and sometimes works. I tried to have 5ttgen fsl continue even in the presence of such a failure, but I might be creating even more problems for myself, I’m not sure.

  • Looks like after this failure, bet runs, but fast doesn’t find its output image. It could be that bet is failing silently, or it might not be conforming to the expected output format based on the FSLOUTPUTTYPE environment variable. You could run the 5ttgen fsl script with the -nocleanup option and have a look at the temporary directory contents.

  • “Unrecognised option m”: No idea whatsoever. That’s an FSL command, so the internals are out of my control.

Regarding ACT, it is stated that T1 image should be rigidly registered to the DWI series before running 5ttgen and tckgen. I was wrongly under the impression that the registration was being done under the hood of tckgen. How can I do that with MRTrix?

Definitely not any registration going on ‘under the hood’. With MRtrix3 we prefer processing steps to be done explicitly, using small but powerful tools with very specific roles, rather than ‘hiding’ what processing is going on.

You won’t be able to blindly send a DWI series and a T1 image to mrregister. Firstly, it currently only supports a mean-squared image difference metric (which relies on images having equal contrast and intensity range). Secondly, because one is a 3D image and one is 4D - it expects to be registering either a pair of scalar images, or a pair of SH images. I have developments in the pipeline for doing T1->DWI registration with MRtrix3, but they’re not yet ready for public consumption. So for now, stick with whatever you’d perform with another package.

Thanks for the tips. I have made some changes to the workflow to get from the DWI and Freesurfer-T1 to an ACT-informed connectome matrix.

I have pasted the steps and outputs for a single subject with a neurodegenerative disease. Will appreciate any comments especially with regards to the tckgen step. The next thing I will like to do is to weight these matrices by (a) mean FA and to (b) normalise the streamline counts by the average volumes between 2 regions :slight_smile:

A. Registration of T1 and aparc+aseg.mgz to processed DTI

  1. recon-all the T1 data with Freesurfer

  2. bbregister b0 images to orig.mgz / brainmask.mgz

  3. tkregister to check/edit registration. This matrix will be used to perform inverse registration of the T1 to DTI space without losing resolution.

  4. Refer to another MRtrix thread for structural-diffusion registration


    Blue = DWI, Greyscale = Aligned T1

B. DWI processing

  1. Denoise DWI
    dwidenoise i.mif i_denoised.mif;

  2. Process diffusion data and perform bias-correction
    dwipreproc -0 i_denoised.nii i_preproc.mif -rpe_none
    dwibiascorrect i_preproc.mif i_biascorrected.mif -fsl

  3. Estimate response function
    dwi2response tournier i_biascorrected.mif i_response.txt

  4. FOD
    dwi2fod csd i_biascorrected.mif i_response.txt i_fod.mif

C. T1 Processing (after Freesurfer and Registration to DWI)

  1. Derive tissue-segmented image
    5ttgen freesurfer i_aparc+aseg_mrtransformed.mgz i_freesurfer_5TT.mif

  2. Visualise 5TT
    5tt2vis i_freesurfer_5TT.mif i_freesurfer_5TT_vis.mif
    @rsmith: Does this look right? The white spots (intensity = 2) correspond to locations of lesions on the WM. How can I deal with them?


    I have also tried 5ttgen -fsl but the I am struggling to get good BETs for the 5TT with over-invasive cuts into the cortical GM…

  3. Modify the integer values in the parcellated image so that the numbers in the image corresponds to the rows and cols of the connectome
    labelconvert i_aparc+aseg_mrtransformed.mgz /Applications/freesurfer/FreeSurferColorLUT.txt /Users/MacPro/mrtrix3/src/connectome/tables/fs_default.txt i_nodes.mif

C. Connectome generation

  1. Streamline tractography
    tckgen i_fod.mif i.tck -act i_FS_5TT.mif -backtrack -crop_at_gmwmi -seed_dynamic i_fod.mif -number 1M -maxlength 250

  2. Perform SIFT
    tcksift i.tck i_fod.mif i_sift.tck -act i_FS_5TT.mif -term_number 500000

  3. Map the streamlines to the parcellated T1 to produce the connectivity matrix
    tck2connectome i.tck i_nodes.mif i_connectome.csv -zero_diagonal
    Transform the matrix into a symmetric form where M is your matrix
    M = M + triu(M,1)' <-- Thanks, @rsmith ! [see MRtrix thread]

  4. View the connectome
    mrview i_nodes.mif -connectome.init i_nodes.mif -connectome.load i_connectome.csv

  5. Load connectivity matrices in MATLAB for analyses with Brain Connectivity Toolbox

2 Likes

Dear Elijah,

I was reading the post and I found it very interesting. I have a small doubt: In the third step of the structural processing, when you use tkregister to register T1 to DTI, how do you conserve the resolution? I mean if the DTI is 2x2x2 (for example) and the T1 1x1x1, the registered T1 should be also 2x2x2, am I correct? or there is something that I am missing…

Regards,

Manuel

Hi Manuel,

I used bbregister to register the DTI --> T1. Personally I have found that bbregister works better than flirt tkregister was simply to check/edit the registration if necessary. This qc-ed registration matrix was then converted into ITK format (might seem strange here but you will see why)

lta_convert --inlta i_register.lta --outitk i_itk.txt

Then, I converted the registration matrix to make it compatible with MRTrix, using the itk_import option in transformconvert If you have done your registrations in FSL, transformconvert has a flirt_import too.

transformconvert i_itk.txt itk_import i_freesurfer_itk_mrtrix.txt;

Finally, transform the T1 or your aparc+aseg (for 5TT) into diffusion space without losing resolution

mrtransform i_aparc+aseg.mgz -linear i_freesurfer_itk_mrtrix.txt i_aparc+aseg_mrtransformed.mgz -inverse -interp nearest

Just a remark: The option -interp nearest should not be neccessary in your last line as mrtransform -linear does not reslice the image but only changes the header transformation which does not alter the resolution. But if your transformation is not rigid, you will end up with a non-orthogonal image transformation which might not be what you want. If you want to reslice the image then use the option -template <reference image>.

Thaks Elijah. Maybe another option would be to up-sample the dwi to the same resolution as the T1, then all the transformations could be applied.

1 Like

Thanks, yes, the option was ignored by mrtransformed, and my transformation was rigid.

In this pipeline so far, the option that I am most unsure of is the 5TTGEN stage. I read the FSL seems to be preferred option over Freesurfer but the BETs are not very satisfactory. Specifically, should we very strict and expect a perfect brain from BET since it will be used for the 5TT and ACT? I keep getting a bit of skull left. From the FSL mailing list it was also recommended not to tweak the -f value for each case, and to keep it consistent across all subjects if possible.

If anyone has experience using 5TTGEN -FSL I’d be keen to know how the brains and 5TT turn out.

Keep up the great work, MRtrix! The community here is very helpful too!

I’m not sure of this, but I think that you can enter the brain without skull to run 5ttgen -fsl. Doing this you should be able to use another software to perform skullstripping, some of the like ROBEX, MASS or ALFA work really good.

The next thing I will like to do is to weight these matrices by (a) mean FA and to (b) normalise the streamline counts by the average volumes between 2 regions :slight_smile:

Personally I advise against that; but to each their own.

dwipreproc -0 i_denoised.nii i_preproc.mif -rpe_none

Only now realised that you’re not correcting EPI susceptibility distortions. As discussed recently in another post, using ACT without having corrected these distortions is definitely going to result in tracking errors, since in areas of significant distortion you won’t be accessing diffusion and tissue data from the same anatomical location. Unfortunately I can’t give definitive advice on how to proceed if you don’t have the prerequisite data though.

Visualise 5TT

5tt2vis i_freesurfer_5TT.mif i_freesurfer_5TT_vis.mif
@rsmith: Does this look right? The white spots (intensity = 2) correspond to locations of lesions on the WM. How can I deal with them?

These come out due to the contents of file scripts/data/FreeSurfer2ACT.txt, which maps FreeSurfer segmentation indices to ACT 5TT tissue volumes. Currently, streamlines will not have any ACT priors applied to them while they traverse through these ‘pathological tissue’ regions. If you don’t want this behaviour, and want to instead label those voxels as white matter, you would do:
mrconvert i_freesurfer_5TT.mif -coord 3 4 -axes 0,1,2 -datatype bit - | 5ttedit - i_freesurfer_5TT_nopath.mif -wm -

I have also tried 5ttgen -fsl but the I am struggling to get good BETs for the 5TT with over-invasive cuts into the cortical GM…

Yes this is very annoying. I’ve set the bet parameter to be very relaxed and over-estimate the brain extent rather than under-estimate, but the precise behaviour is out of my control. Out of curiosity, are you getting the standard_space_roi failure warning? BET performs worse if this stage doesn’t do what it’s supposed to.

tckgen … -number 1M
tcksift … -term_number 500000


Reducing the number of streamlines by a factor of 2 is unlikely to fully correct the biases in streamlines reconstruction density. I would suggest taking a look at the raw plots in the original paper. With dynamic seeding the initial estimate is closer, so you might not need to remove quite as many streamlines as with WM or GM-WM interface seeding, but a factor of 2 is probably still inadequate. Alternatively you can try SIFT2; but poor alignment between DWI and 5TT due to EPI distortions may cause undesirable behaviour with the current SIFT2 solver (individual streamlines getting huge weights)...

> Specifically, should we very strict and expect a perfect brain from BET since it will be used for the 5TT and ACT? I keep getting a bit of skull left. From the FSL mailing list it was also recommended not to tweak the -f value for each case, and to keep it consistent across all subjects if possible.

Yes, I wouldn't be tweaking that value between subjects; manual refinement of the masks would be better than that. If it's really problematic, you can alternatively try using some other software to perform the brain extraction, and feed that to `5ttgen` using the `-mask` or `-premasked` options. And once you've decided on the best program to use, which has a command-line interface, let me know so that I can incorporate it into `5ttgen` and use it myself :stuck_out_tongue:

Hi Rob,

Thanks again for all the feedback. I’d like to ask a quick question on the tcksift comment:

When I used SIFT to reduce the streamlines by a factor of 2 (from 1M to 500k), there was no problem and the tracts still look good on mrview. However, when I tried to go lower (from 1M to 100k), I received the following warning, although tcksift continued to run until the termination number was reached.

tcksift: [WARNING] filtering has reached quantisation error but desired termination criterion has not been met;
tcksift: [WARNING]   disabling cost function quantisation check

What is quantisation error? Does this mean that I should generate more streamlines (perhaps 100million according to the tutorial at the tckgen stage?

Cheers!

there was no problem and the tracts still look good on mrview.

Visualising the tracks in mrview isn’t really adequate in assessing the efficacy of SIFT, since the relative density of streamlines in different areas can be difficult to see. If you’re interested in the performance of tcksift I would suggest trying the -csv and -output_debug options.

What is quantisation error?

The quantisation error limit is best described in the relevant manuscript; it’s slightly hard to describe, even more so without the context of the algorithm operation.

Does this mean that I should generate more streamlines (perhaps 100million according to the tutorial at the tckgen stage?

I would definitely recommend increasing your number of streamlines, but not because of this warning. With only 100k streamlines, and 84 nodes ~ 3500 edges, your mean edge connection density is only ~ 30 streamlines. Therefore you’re going to hit a different type of quantisation issue: you don’t want your streamline counts to be so small that your analysis is heavily influenced by either the quantised nature of streamlines themselves (i.e. can’t have ‘half a streamline’), or the stochastic nature of tracking and seeding (want a sufficiently large number of samples for the result to be reproducible in test-retest).

Hello everyone!

Quick question related to the connectome pipeline.

I used the following command line to convert the labels from freesurfer to mrtrix format.

I was wondering if you could help me troubleshoot why it is not working.

I have set SUBJECTS_DIR, defined ${working_data} and ${file}, then the following command follows

labelconvert ${working_data}/${file}/mri/aparc+aseg.mgz $HOME/FreeSurferColorLUT.txt ~/mrtrix3/src/connectome/config/fs_default.txt ${working_data}/${file}_parcels.mif

Thank you in advance!

Cheers,
Vasiliki

1 Like

Hello!

I have now made the labelconvert command work (so please ignore previous post!) and I have a question about the next step.

So I have completed the mrtrix DWI processing and freesurfer pre-processing.

But… I had not realised that I have to do the co-registration of T1 with DWI before running freesurfer… So I now have all the parcellations done. Is there any way to co-register the pre-processed images?

Cheers,
Vasiliki

Hi @vasiliki,

It’s not absolutely necessary to co-register T1 with diffusion before pre-processing, it just makes things more convenient since anything you subsequently calculate from the T1 from that point should also align nicely with the DWIs.

From the position you’re in, it’s necessary to estimate the transformation necessary to align the T1 image to your DWIs, and then apply that transformation to the parcellation image generated by FreeSurfer. The parcellation image itself cannot be used to drive the registration, since it does not contain image information that is appropriate for matching images; so you need to use another image (i.e. the T1) to guide the registration, have the software output a transformation matrix rather than just a transformed image, and subsequently apply that transformation to the parcellation image, preferably without re-sampling that parcellation image (i.e. it should only require modification of the transformation stored in the header, not mapping to a new voxel grid).

The precise steps you take to do this will depend on precisely what software you use for the registration. MRtrix3’s mrregister currently only supports a basic image difference metric, so can’t do inter-modal registration without some serious trickery.

Cheers
Rob

Hi Rob,

Thank you for your reply.

So regarding the software, I used freesurfer for the parcellation.

Below is the pipeline I came up with.

First, I calculated the transformation matrix (register.dat) between structural and diffusion
bbregister --s ${subj_name} --mov ${working_data}/${subj_name}_ed.nii --init-fsl --dti --reg ${working_data}/${subj_name}_register.dat

Then I transformed the parcellation image (aparc+aseg2diff.mgz)to diffusion space using the above matrix (register.dat)
mri_vol2vol --mov ${working_data}/${subj_name}_ed.nii --targ ${working_data}/${subj_name}/mri/aparc+aseg.mgz --inv --interp nearest --o ${working_data}/${subj_name}/mri/aparc+aseg2diff.mgz --reg ${working_data}/${subj_name}_register.dat

Then, I converted the labels to diffusion space using the command below
labelconvert ${working_data}/${subj_name}/mri/aparc+aseg2diff.mgz /freesurferhome/FreeSurferColorLUT.txt $HOME/mrtrix-0.3.15/src/connectome/tables/fs_default.txt ${working_data}/${subj_name}_parcels2diff.mif

Finally, I overlapped the FOD with parcels2diff.mif to check registration.

Would you advise this is a good pipeline? Would you make any amendments?

Looking forward to your response.

Cheers,
Vasiliki

I’ve never experimented with BBR before so can’t really comment on how well it works, or whether or not your usage is correct. Others are welcome to chime in. Probably my only tip, for registration in general but particularly when trying a method for the first time, is to be extremely vigilant in visually checking your results.

I would however be wary of your terminology here:

Then, I converted the labels to diffusion space using the command below

The labelconvert command doesn’t convert label images ‘between spaces’; it performs no spatial transformations whatsoever. All it does is take one integer value and change it into another integer value. So if in the previous step you’ve done a transformation of the parcellation image into diffusion space, using nearest-neighbour interpolation as is required, then all labelconvert is doing is ‘converting labels’ within a particular space; not to a particular space. But that’s just me being picky :stuck_out_tongue:

Cheers
Rob

Dear Rob,

Thank you for the advice :slight_smile: That’s what I meant. I am sorry for the confusing wording.

I have all the log files from the registration but I do not really know what to check. I have only done the visual check… What would you look at in the registration log files?

Cheers,
Vasiliki