# How to register DTIs

**URL:** <https://community.mrtrix.org/t/how-to-register-dtis/1592>\
**Category:** Uncategorized\
**Tags:** tractography\
**Created:** [April 25, 2018, 6:08pm UTC](https://community.mrtrix.org/t/how-to-register-dtis/1592 "2018-04-25T18:08:25Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jimbo](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jimbo/32/1193_2.png) [@jimbo](https://community.mrtrix.org/u/jimbo)\
**Post date:** [April 26, 2018, 10:56pm UTC](https://community.mrtrix.org/t/how-to-register-dtis/1592/4 "2018-04-26T22:56:19Z")

</div>

I am in the midst of (attempting) to register DWI images to MNI space. While I would like to employ ANTS, but I have yet to figure out that pathway. (_I use MRtrix for the transformation step because I assume MRtrix rotates the B table during the transformation. Can anyone confirm?_) That said, I use FSL’s FLIRT pretty heavily. For my pipeline, I intend to register T1w images to an MNI image. For instance,

```
# Register T1w to MNI space
flirt -in "${t1w}" -ref "${mni}" -dof 12 -omat "affine.mat" -o "t1w2mni_temp.nii.gz"
transformconvert "affine.mat" "${t1w}" "${mni}" flirt_import "affine-mrtrixformat.txt"
mrtransform "${t1w}" "$t1w2mni.nii.gz" -linear "affine-mrtrixformat.txt"

# Register DWI to T1w space
flirt -in "${b0}" -ref "${t1w}" -dof 6 -omat "tmp.mat" -o "b02t1w.nii.gz"
flirt -in "${b0}" -ref "${t1w}" -dof 6 -cost bbr -wmseg "${t1w_wmseg}" -init "tmp.mat" \
-omat "b02t1-bbr.mat" -schedule "${FSLDIR}/etc/flirtsch/bbr.sch" -o "$b02t1w_temp.nii.gz"
transformconvert "b02t1-bbr.mat" "${b0}" "${t1w}" flirt_import "b02t1w-bbr-mrtrixformat.txt"
mrtransform "dwi.mif" "dwi2t1w.mif" -linear "b02t1w-bbr-mrtrixformat.txt"

```

See this link for why I use two FLIRTs in the DWI registration:

> [@Registration of structural and diffusion weighted data](http://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203/17):
>
> Hi all Thanks for providing so much information. I’m trying to reproduce Kerstins above mentioned protocol for image registration. Unfortunately I get an error message after the 2nd command: Could not open matrix file tmp.nii.gz I can run the command without the -init part and continue, but after mrtransform, I receive a non-registered and quite distorted t1 (see image at the end). Flirt registration from within the fsl gui works fine, but there I end up with such a low quality t1 image w…

The last step would be to apply the T1w-MNI affine to the registered DWI

```
# Register DWI to T1w-MNI space
mrtransform "dwi2t1w.mif" "dwi2mni" -linear "affine-mrtrixformat.txt"

```

---

_[View the full topic](https://community.mrtrix.org/t/how-to-register-dtis/1592)._
