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.
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! ^ ^
Best,
yuting
Hello,
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.