# Registration of structural and diffusion weighted data

**URL:** <https://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203>\
**Category:** Uncategorized\
**Created:** [May 4, 2016, 6:44pm UTC](https://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203 "2016-05-04T18:44:56Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![Lucius](https://community.mrtrix.org/user_avatar/community.mrtrix.org/lucius/32/1156_2.png) [@Lucius](https://community.mrtrix.org/u/Lucius)\
**Post date:** [August 22, 2017, 2:55pm UTC](https://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203/17 "2017-08-22T14:55:09Z")

</div>

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 which is not useful at all 😕  
I tried it with skull stripped images as well - also not successful.  
Does anyone have suggestions for a better registration?

I appreciate any help and I am sorry for my naive question.  
Best regards, Lucius

> [@Kerstin](#):
>
> flirt -in nodif\_brain.nii.gz -ref structural\_brain.nii.gz -dof 6 -omat tmp.mat
> 
> flirt -in nodif\_brain.nii.gz -ref structural\_brain.nii.gz -dof 6 -cost bbr -wmseg structural\_WMseg.nii.gz **-init tmp.nii.gz** -omat diff\_to\_structural-bbr.mat -schedule $FSLDIR/etc/flirtsch/bbr.sch
> 
> where structural\_WMseg.nii.gz is a white matter segmentation (binary image) from the structural image, e.g. from FSL FAST.
> 
> Then transform the flirt matrix to mrtrix format
> 
> transformconvert diff\_to\_structural-bbr.mat nodif\_brain.nii.gz structural\_brain.nii.gz flirt\_import diff\_to\_structural-bbr-mrtrixformat.txt
> 
> And apply to the structural image
> 
> mrtransform structural.nii.gz -linear diff\_to\_structural-bbr-mrtrixformat.txt structural.coreg.nii.gz -inverse

 ![screenshot0000](https://community.mrtrix.org/uploads/default/original/1X/54561dbdc8955f02c055d7b5aace3ed58431948c.jpg)

---

_[View the full topic](https://community.mrtrix.org/t/registration-of-structural-and-diffusion-weighted-data/203)._
