-
Notifications
You must be signed in to change notification settings - Fork 2
38. Registration between SMS‐InI and anatomical MRI
Here are details of generating a registration matrix between SMS-InI data and anatomical MRI
-1.a. Prepare an initial registration matrix
First, you need to have an initial registration matrix file, such as this one. If not, please create one as the following:
s002
5
5
0.250000
0.0421 0.9796 0.1969 1.8653
0.0262 -0.1982 0.9798 -31.0046
-0.9988 0.0362 0.0341 -2.7172
0 0 0 1.0000
round
Note that the first line indicates the subject (in your $SUBJECTS_DIR) to be used as the anatomical template. In this case, it is subject s002. Save this text file as, for example, bb_register_init.dat
.
Then, use this script to show the registration between fMRI and anatomical MRI. Remember to check if the subject indicated at the 2nd line of the code matches the subject in bb_register_init.dat.
-1.b. Manually coregister between fMRI and anatomical MRI (FreeSurfer recon) Run this script to show fMRI overlaid on structural MRI
1.b.1 Click anywhere of the 3D brain surface model. This will bring up another window showing axial, saggital, and coronal brain slices with fMRI overlays.
1.b.2 Click 'g' and "Display" control windows will show. You many change the threshold min. and max. there to allow you visualize the relative positions of fMRI and structural MRI volumes.
1.b.3 Checking and unchecking "Show surface overlay" and "Show vol.overlay" allow you to show fMRI overlay or not in brain surface model and slices.
1.b.4 Click 'k' and "register" control window will show. You many rotate and translate fMRI. Note that here the rotation and translation are made with respect to the 3D brain surface model view. So you may first determine the best view by enabling and rotating the 3D rotation in the brain surface. Then apply the appropriate translation and rotation. Repeat until you feel ok about the overlap between fMRI and structural MRI.
1.b.5 Export the registration now by click "export" button at the "register" control window. Now a new variable overlay_xfm
exists in your Matlab workspace. As you have a variable r
describing the initial transformation after running the registration script, you can calculate the new transformation as r * overlay_xfm.
1.b.6 Update the transformation matrix by open an editor and update the content of bb_register_init.dat by the 4x4 16 numbers in the file.
NOTE In Windows, please consult this script for the process. Please unzip all files before calling this script.
-1.c. Run bb_register
to get more accurate registration
Run this script to register between fMRi and structural MRI. THe command below specifies register subject s002 the converted EPI run 005 (epi_005_f.mgh) based on an initial transformation (bb_register_init.dat) with the structural MRI. The registration matrix is generated as bb_register_epi_005.dat.
bbregister --s s002 --mov epi_005_f.mgh --init-reg bb_register_init.dat --reg bb_register_epi_005.dat --bold
-1.d Confirm the registration is ok
Using freeview
confirms the registration (between EPI epi_063_f.mgh) with the output registration file (bb_register_epi_063.dat) as follow.
tkregisterfv --mov epi_063_f.mgh --reg bb_register_epi_063.dat --surfs --sd /Users/fhlin/workspace/eegmri_music/subjects
NOTE Codes were tested based on files at /space_lin2/fhlin/smsini_blipud/011624/analysis
on March 8 2024.
Data path:/space_lin2/fhlin/smsini_blipud/011624/analysis FreeSurfer recon path: /space_lin2/fhlin/smsini_blipud/subjects
Subject 011624
is used for demo below.
[This script file] prepares slices of EPI data matched with SMS-InI reference data.
A few MGH files with data from EPI should be created. In this examples, they are epi__epi_blipdown.mgh and epi__epi_blipup.mgh.
IMPORTANT! On March 8 2024, blipped-down SMS-InI has swapped the order of phase encoding direction. So the A-P direction of blip-down SMS-InI was the opposite of the A-P direction of blip-up SMS-InI. And the EPI has the same A-P direction as blip-up SMS-InI. In other words, the EPI to be used for blip-down SMS-InI registration should swap the phase-encoding direction (A-P; columns in images). You may use flipdim
command at Matlab to do this and save a separate files.
Namely, epi__epi_blipdown.mgh is used to create a new epi__epi_blipdown_fliplr.mgh file with images reverse the column order. So epi__epi_blipdown_fliplr.mgh is used to create the registration matrix to be applied to blip-down SMS-InI, and epi__epi_blipup.mgh is used to create the registration matrix to be applied to blip-up SMS-InI.
Please refer to step 1.a above for this step. Use [this script] and [this script] to register between EPI and anatomical MRI.
Here, two initial registration matrices [bb_register_blipdown_init.dat] and [bb_register_blipup_init.dat] must be created by a text editor. You can copy them for the your convenience. As these two matrices have been manually adjusted, running registration scripts with the provided registration matrices should give you a pretty good initialized registration.
Please refer to step 1.b above for this step.
Run the following commands to use bb_register with initial registration matrices to create the fine-tuned registration matrices (bb_register_blipdown_epi.dat and bb_register_blipup_epi.dat)
bbregister --s 011624 --mov epi__epi_blipdown_fliplr.mgh --init-reg bb_register_blipdown_init.dat --reg bb_register_blipdown_epi.dat --bold
bbregister --s 011624 --mov epi__epi_blipup.mgh --init-reg bb_register_blipup_init.dat --reg bb_register_blipup_epi.dat --bold
Here are contents of [bb_register_blipdown_epi.dat] and [bb_register_blipdown_epi.dat].
Because resolution difference (EPI: 3.2812 mm in-plane resolution with 64x64 image matrix and 210 x 210 mm FOV; SMS-InI: 5 mm in-plane resolution with 42x42 image matrix and 210 x 210 mm FOV), the registration files created by bb_register must be modified before being used for SMS-InI.
First, we created copies such that bb_register_blipup_epi.dat has a copy of bb_register_blipup_epi_5.dat. We also make a copy of bb_register_blipdown_epi.dat to create bb_register_blipdown_epi_5.dat. The "5" by the end of the file name denotes that it is used for 5 mm in-plane resolution.
Second, use a text editor to modify the 2nd line such that it is 5, rather than 3.2812.
The content of bb_register_blipdown_epi.dat
:
011624
3.2812
5.000000
0.250000
8.977486938238144e-02 9.948976635932922e-01 -4.553578794002533e-02 7.101538658142090e+00
7.891905494034290e-03 4.503807052969933e-02 9.989647865295410e-01 -1.729566955566406e+01
9.958881139755249e-01 -9.018189460039139e-02 -3.689576871693134e-03 -1.566511631011963e+00
0 0 0 1
round
The content of bb_register_blipdown_epi_5.dat
:
011624
5
5.000000
0.250000
8.977486938238144e-02 9.948976635932922e-01 -4.553578794002533e-02 7.101538658142090e+00
7.891905494034290e-03 4.503807052969933e-02 9.989647865295410e-01 -1.729566955566406e+01
9.958881139755249e-01 -9.018189460039139e-02 -3.689576871693134e-03 -1.566511631011963e+00
0 0 0 1
round
Also modify the file bb_register_blipup_epi_5.dat
such that its 2nd line is 5.
[Here] is the script.
[Here] is the script.