Coregistration between anatomical scans and tck files

Hello MRtrix experts,

First, thank you so much for this very helpful forum !!!
Could you help me regarding the steps to coregister anatomical files (t1 images (1 x 1 x 1 mm3) and tck files (10000000) after tckedit
I tried in different ways to coregister anatomical files and tck files but it doesn’t work.
What are the steps (line command) the most used to coregister T1 and tckfiles ?

Thanks for reading,
I need some help from you,
Best,

Jennifer

Hello Jennifer

To register you streamlines to your anatomical (T1w) image, you need to first coregister your original diffusion scan (from which your streamlines are derived) with the T1w.

There are all sorts of tools for coregistering anatomical and diffusion scans, it depends on how refined you want the registration to be (typically rigid registration is enough for two scans of the same subject and scan session). FSL’s flirt or epi_reg tools are a popular choice, or ANTs, or…
There are some extensive discussions about it on the forum, e.g. here or here.

Once you have your registration, you have two choices. The easiest is to transform your T1w image into diffusion space. Then you don’t have to bother with transforming streamlines, which is a bit more fiddly.
Using flirt, these are the steps I use for this:

# create a mean b0 image
dwiextract dwi.mif -bzero - | mrmath -axis 3 - mean b0mean.nii.gz
# rigid body (6dof) with flirt
flirt -dof 6 -cost normmi -in t1.nii.gz -ref b0mean.nii.gz -omat t_t1_2_b0_fsl.txt
# convert the transformation matrix from fsl format into one usable by MRtrix
transformconvert t_t1_2_b0_fsl.txt t1.nii.gz b0mean.nii.gz flirt_import t_t1_2_b0_mrtrix.txt
# transform t1 into b0 space (without regridding)
mrtransform -linear t_t1_2_b0_mrtrix.txt t1.nii.gz t1_coreg2b0.nii.gz

But if you require everything to be in T1 space, then you can use tcktransform to do that. Max’s wiki article has a good explanation on the theory of registration and transformation. You might also find this thread (using ANTs) helpful.

here’s an example:

# tcktransform only accepts warps, not transform matrices, so we have to 
# construct one using our registration transform
warpinit t1.nii.gz wi.mif
# for streamline transformation we need to use the inverse transform to 
# the direction we want to go in, hence t1_2_b0 for registering from b0 to t1 space...
transformcompose wi.mif t_t1_2_b0_mrtrix.txt warp.mif -template b0mean.nii.gz
tcktransform streamlines_in_dwi-space.tck warp.mif streamlines_in_t1-space.tck

good luck!
Fiona

1 Like

Hi Fiona,

Thank you so much for take your time to me reply in details.
I will follow your explanation very helpful to register streamlines on anatomical scan.

Have a good day,

Best,
Jennifer