DWI to T1w alignment, but poor effect

After the motion and distortion correction, I conducted the DTI to T1w alignment with the following lines.

# motion and distortion correction
dwifslpreproc degibbs.mif geomcorr2.mif -rpe_none -pe_dir PA -json_import "$dti".json -eddy_options " --data_is_shelled --slm=linear --niter=5"

# prepare for alignment to T1w
# extract mean_b0
dwiextract geomcorr2.mif - -bzero | mrmath - mean mean_b0.nii -axis 3
flirt.fsl -dof 6 -cost normmi -ref "$t1w".nii.gz -in mean_b0.nii -omat T_fsl.txt
transformconvert T_fsl.txt mean_b0.nii "$t1w".nii.gz flirt_import T_DWI2T1.txt
mrtransform -linear T_DWI2T1.txt geomcorr2.mif align.mif

and all these commands works well, but then when I overlapped the align.mif on the top of the T1w, it works badly (see below).

even worse than before alignment (ie. overlapped the geomcorr2.mif on the top of the T1w, see below)

I wonder that what cause this phenomenon? Is there any problem with my lines?

Thank you in advance!!

Dear @hyting ,

Your code looks fine (if you intend to move the DWI to the T1 and not the other way around), but this can happen for various reasons and sometimes it might take a bit of trial and error to get a good registration.

Try outputting the registered mean_b0 from the FLIRT step (using the -o flag) and see if that worked as expected (overlay that file as you have done now) - likely it hasn’t and that’s why you have downstream issues. You can try using a different cost function to see if that does the trick.

Hope this helps,

1 Like

In addition to Nick’s suggestions, in my experience FLIRT can struggle with images that include a lot of non-brain tissue (i.e. full head scan with neck etc.). You might get better results by first running FSL’s bet on your T1 image (may also take trial and error; I often find I need to provide it with the brain center of mass voxel using the -c option) and running registration on the brain-only image.

Hi, fiona,
According to your suggestion, I ran the same codes with the T1w after bet, this time the alignment works better.
Thank you a lot! ^ ^


In addition to the above suggestions, you can also look into the epi_reg script from the FSL. It is designed specifically for DWI to T1 registration.

From my experience it is very robust.

You will need both brain extracted and whole head T1 images for this approach.

More info can be found here FLIRT/UserGuide - FslWiki

1 Like

Following your sugguestion, I registered the dwi to T1w with epi_reg, and as you said, it works excellent! Except the alignment image, it also generated the wmedge.nii.gz and wmseg.nii.gz. And I compared the flirt.fsl alignment image with epi_reg 's, they are exactly the same. But the epi_reg works better with wmedge.nii.gz and wmseg.nii.gz than 5tt2gmwmi and 5ttgen does.

Thank you for your recommendation! :smiling_face_with_three_hearts: