The aim of this page is to demonstrate how to use a gradient echo B0 field map to perform distortion correction and registration of fMRI and structural images.
The required dataset include:
- Original (non-brain-extracted) T1 weighted image: T1.nii.gz
- A single 3D volume from a functional EPI acquisition: blip_down.nii.gz
- A field map acquisition (phase and magnitude): FieldMap.nii.gz and Mag_e2.nii.gz
For the EPI distortion correction using a GRE field map, the first step is to acquire the required data with the Siemens gre_field_mapping pulse sequence for the B0 field map calculation using the available FSL tools. please check out here.
The collected T1 weighted structural image needs to be prepared:
Step 1: Brain extract the T1 weighted structural image using bet_gui.
Step 2: Segment the brain extracted T1 weighted image as it will be needed later by the boundary-based registration in order to identify the desired boundaries (i.e. white matter boundaries):
fast -B -I 10 -l 10 PATH/T1_brain.nii.gz
This will create several outputs in the PATH directory, of which the most important one for our purpose is the white matter partial volume estimate: T1_brain_pve_2.nii.gz.
Load this, along with the T1_brain.nii.gz into FSLeyes to assess the performance:
Step 3: Make a binary segmentation from the white matter partial volume estimate T1_brain_pve_2.nii.gz from step 2, which will be used to identify the boundary points:
fslmaths PATH/T1_brain_pve_2.nii.gz -thr 0.5 -bin PATH/T1_wmseg.nii.gz
Where -thr 0.5 indicates that all voxels with more than 50% partial volume are selected as part of the binary mask. This will be used later on to assess the quality of the distortion correction.
Results obtained using BBR are usually substantially better than alternative methods and this is now the strongly recommended way to register EPI and structural images. Viewing the transformed EPI with an overlay of the white-matter boundaries is a very good way to assess the accuracy of the registration, and distortion corretion.
Now that the field map and the structural image are processed, we can apply the BBR registration of the fMRI (EPI) to the structural, using the field map information from section 2 to correct for geometric distortion.
Two EPI parameters are needed here:
- Effective echo spacing: in our case 0.51ms
- Phase encoding direction: blip down (i.e. AP or -y), or blip up (i.e. PA or y)
Having all the required data in the FSl directory, for the EPI data collected with a blip down phase encoding scheme, run:
epi_reg --echospacing=0.00051 --wmseg=T1_wmseg.nii.gz --fmap=FieldMap.nii.gz --fmapmag=Mag_e2.nii.gz --fmapmagbrain=Mag_e2_brain.nii.gz --pedir=-y --epi=blip_down.nii.gz --t1=T1.nii.gz --t1brain=T1_brain.nii.gz --out=func2struct_negy
and for the EPI data collected with a blip up phase encoding scheme, run:
epi_reg --echospacing=0.00051 --wmseg=T1_wmseg.nii.gz --fmap=FieldMap.nii.gz --fmapmag=Mag_e2.nii.gz --fmapmagbrain=Mag_e2_brain.nii.gz --pedir=y --epi=blip_up.nii.gz --t1=T1.nii.gz --t1brain=T1_brain.nii.gz --out=func2struct_posy
The main outputs of interest are (for the negy version as an example):
- func2struct_negy.nii.gz: the functional image resampled into structural space, and distortion corrected
- func2struct_negy_fast_wmedge.nii.gz: binary image representing the white matter boundaries from the T1 weighted structural image, which is very useful for viewing and assessing registration quality (normally shown in red on top of transformed functional image)
To assess the results, load the two main outputs func2struct_negy.nii.gz and the func2struct_negy_fast_wmedge.nii.gz into FSLeyes or any other viewer, give the latter a Red colormap, and put it on top of the overlay list.
MRI scans were performed on a Siemens 3T Prisma scanner on a healthy female volunteer. The resting-state EPI data were acquired with the FOV = 210 * 210 mm2, matrix size = 64 * 64, spatial resolution of 3.3 * 3.3 * 2.5 mm3, TR/TE = 1500/30 ms, rBW = 2232 Hz/Px, echo spacing of 0.51ms, and total acquisition time of ~5 mins for 200 bold measurements. Scans were repeated for both blip down and blip up phase encoding directions. T1 weighted structural image was collected using a high resolution MPRAGE protocol. The B0 field map acquisition was performed as explained here.
Sample axial EPI brain slices registered to the structural image, (left) distortion corrected, and (right) uncorrected: