Bbregister for generating atlas

Hello Mrtrix3rs,

I’m trying to register the glasser + aseg atlas to diffusion data. Ideally, I would rather use bbregister than flirt. As the transform mats are not identical between the two methods, which one is recommended? Is there any way I could still use the dwi2orig.dat and perform some operation on it to get it to what mrtrix “expects”?

Method 1: Register atlas using bbregister.

bbregister --s sub-i --mov b0_preproc.nii.gz --reg dwi2orig.dat --t2 --init-fsl
mri_vol2vol --s sub-i --mov b0_preproc.nii.gz --reg dwi2orig.dat --targ glasser+aseg.nii.gz --o glasser+aseginDWI.nii.gz --inv --interp nearest

transformconvert dwi2orig.dat  b0_preproc.nii.gz orig.mgz flirt_import dwi2orig_mrtrix.txt -force

mrconvert glasser+aseg.nii.gz glasser+aseg_good.mif -force

mrtransform glasser+aseg.mif -linear dwi2orig_mrtrix.txt glasser_aseg_parcels_coreg_dwi2orig_mrtrix.mif –inverse

Method 2: Register atlas using flirt.

flirt -in b0_preproc.nii.gz -ref T1_raw.nii.gz -interp nearestneighbour -dof 6 -omat dwi2T1_fsl.mat 

transformconvert dwi2T1_fsl.mat b0_preproc.nii.gz T1_raw.nii.gz flirt_import dwi2T1_mrtrix.txt -force

mrconvert glasser+aseg.nii.gz glasser+aseg_good.mif -force

mrtransform glasser+aseg_good.mif -interp nearest -linear dwi2T1_mrtrix.txt –inverse glasser_aseg_parcels_coreg.mif -force

__Error:__ Note i'm getting the following error when using mrtransform.
mrtransform: [ERROR] Expected exactly 2 arguments (3 supplied)
mrtransform: [ERROR] Usage: mrtransform input output
mrtransform: [ERROR] Yours: mrtransform glasser+aseg.mif –inverse glasser_aseg_parcels_coreg.mif

Many thanks for any help you can offer!
-Heena

I’d choose the method based on the accuracy and robustness on your data.

transformconvert can convert flirt or ITK transformations. Unless bbregister uses one of these file format conventions (I don’t know), this conversion to mrtrix format won’t work. You could create an identity warp and warp that to target space using mri_vol2vol to make a (linear) warp file as described in the wiki. Alternatively, you might want to use flirt with the bbr-type cost function.

This might be related to a long dash issue.

Thanks @maxpietsch!

Since i’m trying to create a multimodal connectome, I do think surface based information is useful for registering the atlas to diffusion space. I used your advice and code provided in this post (Beginner: Connectome pipeline (Updated) - #6 by mblesac) by @ElijahMak to register the atlas in T1 to pts’ diffusion space.

bbregister --s sub-i --mov i_b0_preproc.nii.gz --reg dwi2orig.lta --t2 --init-fsl

lta_convert --inlta dwi2orig.lta --outitk dwi2orig_itk.txt

transformconvert dwi2orig_itk.txt itk_import dwi2orig_itk_mrtrix.txt

mrtransform i_glasser+aseg_good.nii.gz -linear dwi2orig_itk_mrtrix.txt glasser+aseg_good_indwi.nii.gz -inverse -interp nearest

Also, using the regular dash corrected the issue with inverse.

Thanks!
Heena