Neuroimaging Data Processing/Coregistration and Normalization

Concept of Coregistration

Generally, coregistration refers to the spatial alignment of a series of images, either from intra-subject or inter-subject image volumes and is utilized in several steps of preprocessing. Coregistration most often refers to the alignment of functional and structural images from the same subject to map functional information into anatomical space. Normalization refers to the coregistration of the subjects (mostly anatomical) image to a standard template to overcome the issue of brain shape variability from different subjects. (Besides, Realignment coregisters intra-subject time-series image volumes to against head motion of subjects.)

A typical workflow is to coregister an average EPI image to the subjects structural image through affine transformation (i.e. linear, preserving proportions) and warping the structural image to a template using nonlinear transformation. The resulting transformation information from the second step can be applied to the coregistered EPI from the first step to obtain functional information in standard space.

Preprocessing of anatomical images

The anatomical images used in these procedures have to be preprocessed as well. Depending on the application and the mode of coregistration this can include removing slow frequency drifts (see Data Quality and Temporal Filtering), Field map correction, Surface extraction and tissue segmentation (see also Surface extraction. Depending on the software these steps can be implemented as a part of the coregistration procedure.

Structural-functional coregistration

If the aim is to study how functional activations of a subject overlay to individual's own anatomy, functional and structural images of the same brain should be aligned together. However, the difference between the functional and structural images from the same brain is not trivial. By contrast to the high-resolution structural images with clear region boundary contours, functional images are normally blurry and suffered from geometric and intensity distortions. The basic idea regarding coregistration herein is similar to the realignment, i.e. defining a cost function with the goal to minimize the differences on image parameters among images. However, because of distortions on functional images, the rigid-body transformation with six parameters may be not enough to correct. Depending on the complexity of distortions, either a nine-parameter transformation with another three additional parameters accounting for scaling differences on x-, y- or z- axes or even more sophisticated algorithms could be used to quantify the cost function. Meanwhile, as a result of the different contrasts between functional and structural images, the mutual information is more suitable to act as cost function than the sum of squared differences.

Spatial normalization

Human brains are variable in their size and shape. Such structural variability of brains imposes obstacles on intersubject brain function studies in how to determine regional correspondence from brain to brain despite of their divergence. The attempts are mainly focusing on setting up a reference frame in a three-dimensional Cartesian coordinate space as a common space for different brains to align to. The ultimate goal of spatial normalization is the spatial transformation of brains into a common space, making them comparable to each other.

Templates

A template refers to a representative image with anatomical features in a coordinate space, which then provides a target to individual images aligned to. The very first attempt to model a reference brain atlas was proposed by Jean Talairach in 1967. A set of anatomical landmarks were defined as anterior commissure (AC), posterior commissure (PC), the midline sagital plane and the exterior boundaries of the brain at each edge respectively. On the basis of these anchors in brain, a three-dimensional coordinate space was built up. To be more specific, anterior commissure (AC) is set up as origin and the direction from AC to PC is the Y axis; the longitudinal (interhemispheric or midsagittal) fissure conferencing to Y axis is Z axis; the last X axis is perpendicular to the YZ plane. Talairach coordinates provide a possibility to normalize any brain to this template by a well-defined procedure. However, such Talairach space template is not perfect, and the limitations regarding to the lack of MRI scan base and unrepresentative of population [1] call for further developments. Currently the most commonly used templates are proposed by Montreal Neurological Institute (MNI), known as the MNI templates. Here 241 normal MRI scans were taken as a basis to manually define various landmarks, in order to identify a line very similar to the AC-PC line, and the edges of the brain. Each brain was scaled to match the landmarks to equivalent positions on the Talairach atlas. Then 305 normal MRI scans (all right handed, 239 M, 66 F, age 23.4 +/- 4.1) were matched to the average of the Talairach matched 241 brains using an automated 9 parameter linear algorithm and an average of 305 brains was created, the MNI305.[2] The MNI305 was the first MNI template. The current standard MNI template is the ICBM152, which is the average of 152 normal MRI scans that have been matched to the MNI305 using a 9 parameter affine transform.

Spatial normalization methods

Landmark-based

For a landmark-based normalization, a cuboid in AC-PC space is defined, which requires specification of additional landmarks specifying the borders of the cerebrum. Then the bounding box is sub-divided by several sub-planes into 12 sub-cuboids. In a final Talairach transformation step, each of the 12 sub-cuboids is compensated to match the corrsponding standard Talairach template by mathematical stretching, squeezing and warping the sub-cuboids. According to such piecewise linear transformation, the difference between the each brain and the Talairach template obtains minimum.

Volume-based

Volume-based normalization aims to maximize the overlapping voxels in the intersection region of the template and individual target image on the basis of normalized correlation coefficient (NCC). Suppose the template image as X, and the target image represented as X', the overlapped region between individual target image X' and template X can be denoted as:

${\displaystyle X_{0}=\{{X_{0}:X_{0}\in X\cap T(X')}\}}$ ..........(1)

${\displaystyle T}$ : a rigid body transformation

The overlapped voxels between template and target image are:

${\displaystyle F(X_{0})}$ : intensity set of overlapped voxels in template

${\displaystyle G(X_{0})}$ : intensity set of overlapped voxels in target image

The normalized correlation coefficient (NCC) between overlapped sets are:

${\displaystyle NCC(F,G)={\frac {1}{N_{0}^{2}}}{\frac {\sum _{x_{0}\in X_{0}}(f(x_{0})-{\overline {f}})(g(x_{0})-{\overline {g}})}{\sigma _{f}\sigma _{g}}}}$ ..........(2)

${\displaystyle {\overline {f}}}$ : mean intensity of voxels in ${\displaystyle F(X_{0})}$

${\displaystyle {\overline {g}}}$ : mean intensity of voxels in ${\displaystyle G(X_{0})}$

${\displaystyle \sigma _{f}={\frac {1}{N_{0}}}{\sqrt {\sum _{x_{0}\in X_{0}}(f(x_{0})-{\overline {f}})^{2}}}}$ ..........(3)

${\displaystyle \sigma _{g}={\frac {1}{N_{0}}}{\sqrt {\sum _{x_{0}\in X_{0}}(g(x_{0})-{\overline {g}})^{2}}}}$ ..........(4)

Finally, try to maximize the normalized correlation coeffcient in equation (2) to achieve the spatial normalization.

Surface-based

Instead of using a full brain volume to perform the normalization, surface-based methods consider the cortical surface alone. The methods normally involve two steps, 1). extraction of the cortical surface from the anatomical image (see Surface extraction); 2). registration to a surface atlas. Surface features like sulci and gyri are taken into account possibly enhancing coregistration accuracy. However, this approach is limited to research questions involving the cortical surface.

Quality control

It's very necessary to check the performance of normalization with the aim to detect outliers in a series of normalized images. To summarize, the methods fall into three general categories.

1. Check the overlap between the template and the normalized image by coregistration strategy
2. Inspect the averaging image of all normalized brains. A good normalization result expects a blurry version of a brain. If there is a brain image showing extraordinary, then it implies some problems during the normalization procedure.
3. View the series of normalized images as a movie (e.g. in FSLView), jump out images are identified as outliers for a normalization.

Implementations

SPM

Coregistration

In SPM, coregistration of functional and structural images can be done by the Coregister module in the GUI (fMRI section). There are three options provided: Coregister (Estimate), Coregister (Reslice) and Coregister (Est & Res). Your choice will depend on further steps. If only “Estimate” is selected, the transformation matrix for coregistration will be estimated and the transformation parameters will be stored in the header of the source imaging, without actually applying it to the image. This is recommended if other spatial transformations are planned to follow the coregistration, e.g. normalization. In that case the spatial transformation parameters from each spatial transformation will be combined and only finally be applied to the data in one step, reducing negative side effects of the transformation step. On the other hand, "Estimate & Reslice" will estimate the transformation and also apply it to the data, generating a new dataset with the prefix 'r' (as a default, can be adjusted). Choosing only "Reslice" assumes that you already have the transformation files toapply to you images, which you'll be queried to provide.

Herein, we selected the “Coregister (Estimate)” option to do the transformation alone as a normalization step will follow.

1 Main GUI with coregister module (estimate) selected

When clicking this button a Batch Editor is showing up with several parameters to set. First, define the reference image by highlighting on Reference Image row, and click on the button Select Files in the bottom. Select the file you want to coregister to (depending on the direction you wish, e.g. the mean realigned functional image, therefore, filter the files in the select files menu on mean) and click Done Do the same for the Source Image parameter, this time choosing the file you want to coregister to your reference image (e.g. anatomical image). Note that the reference image is assumed to keep constant, and the source image is supposed to match to it later on. For other images, you can choose all other functional images if they also shall be coregistered. Under Estimation Options there are four adaptable parameters which you can adapt or leave at default settings as we did here. To learn more about any parameter to set, click on the according row and read the description in the box at the bottom. Click the green triangle in the menu bar of the batch editor to run the coregistration.

2 Batch editor

After the calculation is finished both the source and reference image are displayed in the graphics window.

3 Graphics window displaying results

Normalisation

For normalisation choose the module Normalise in the main fMRI GUI. Again there are three options Normalise (Estimate), Normalise (Write) and Normalise (Est & Write). Though the naming is a bit different the meaning is pretty much the same as for the coregister module (see above, reslice is replace by write). In case normalisation is the final spatial transformation step as for our example, Est & Write should be chosen, since we want to estimate the transformation to the template space and apply both transformations, the coregistration and the normalisation, to the functional volumes.

1 Main GUI with normalisation (Est&Write) selected

Once the Batch editor has openend, highlight the row Data and click on New Subject in the box below to create a new subject (or more if you like). You have to select three (sets of) files by highlighting the respective row, clicking on select files, choosing your files and clicking Done. Remember that there is a filter option in the Select files menu, making you life much easier. First you select the Source Image, this is the image for that the transformation into standard space is calculated, mostly the high resolution anatomical image. Next you define the Images to Write, i.e. the images you want to apply your transformations to. Here this will be all our realigned (prefix r) functional images because we want to have them warped into standard space. Then choose the Template Image. The Select File button will automatically direct you in SPM's template folder where you find MNI templates. Choose the one that matches your source images, in this case T1. Finally, you can adjust all other parameters if you want. It makes sense to adjust Voxel sizes to the voxel size of your images to write to (for functional often [3 3 3], highlight the respective row and click Edit Value below). You cannot achieve a higher resolution than your original images are, lower voxel size values will only increase the size of your data.

2 Batch editor

Now you can run the batch by pressing the green triangle. It is important that in the previous step we coregistered the anatomical image, which we now use to calculate transformation to standard space, to the mean functional image. So now we apply both transformations (functiona-anatomical and anatomical-template) to all functional images and thus warp them into standard space. After running SPM will have created a new set of data, prefixed with w (for warped), which you can watch via the Display or Check Reg button in the main GUI. The latter enables you to display more than one dataset at a time, unfortunately no overlay is supported to visually inspect the alignment of functional, structural and templated images. You might want to use another software like FLSview instead.

AFNI

Oblique data

For coregistration problems with oblique data, see AFNI

Coregistration

align_epi_anat.py script computes the alignment between two datasets, typically an EPI and an anatomical structural dataset, and applies the resulting transformation to one or the other to bring them into alignment.[3] The transformation is calculated to align the anatomical to the epi data, but the resulting transformation can be used either way that is specified. Basic input is anatomical and epi dataset, which epi volume should be the base of alignment, direction of alignment (0/mean/median/max/volume#) and which direction of alignement is required (anat2epi/epi2anat), e.g.:

align_epi_anat.py anat2epi -anat ANATOMICALDATA -epi EPIDATA -epi_base mean


In afni_proc.py the align block is not set by default but can be included by

-do_block align


By default this means anat2epi registration, which can be changed with the following option:

-volreg_align_e2a


To check if your coregistration has worked choose the aligned (and skullstripped) anatomical as Underlay and epi as Overlay (or vice versa if you have aligned the other way around) and decrease the opaqueness of the overlay (default is 9)

Visualization of coregistration in afni

Normalisation

@auto_tlrc [4] is a script to transform an antomical dataset to match a template in Talairach space.

@auto_tlrc -base TEMPLATE -input ANATOMICAL


Note that this script also performs skullstripping unless instructed otherwise (-no_ss). It can actually also be applied to epi data and not only to anatomical.

In afni_proc.py normalization can be achieved by including do_block tlrc which by default uses TT_N27+tlrc as a base and affine registration (can be changed by -tlrc_NL_warp)

-volreg_tlrc_warp


additionally tells afni_proc.py to apply that transformation to the EPI data at the volreg step (this is then implemented as part of 3dAllineate[5]). So the output of the volreg block will be in Talairach space.

Combine spatial transformations

Spatial transformations in afni are done one after the other. There is however a way to apply all your spatial transformations in one step (see SPM Implementation part for why to do this). The way to do this in afni is to actually run the different spatial transformations but not to use the created datasets but only the transformation matrices that are also calculated. This matrix is a default output of align_epi_anat.py whereas if you want to include the realignment matrix you'd have to tell 3dvolreg explicitly to store the matrix (as mentionend in the Realigment chapter). @auto_tlrc cannot store the matrix but it can be extracted from the created +tlrc file. An example for a workflow would be this

Calculate realignment to mean image while storing transformation matrix

3dTstat -mean -prefix mean_func_deob func_tshift+orig
3dvolreg -twopass -1Dfile realign_par.1D -1Dmatrix_save realign_mat.aff12.1D -base mean_func_deob+orig  -prefix func_realigned  func_tshift+orig


Calculate coregistration of anatomical to slicetime corrected EPI series (NOT realigned ones), saving the skullstripped anatomical image for normalisation (the three last options are required here since all these steps have been done before)

align_epi_anat.py -anat2epi -anat anat+orig -epi func_tshift+orig -epi_base mean -save_skullstrip -volreg off -tshift off -deoblique off


Normalise skullstripped anatomical image produced above (NOT the coregistered one) to talairach space, skipp skullstripping (-no_ss) because that's already done

@auto_tlrc -base TT_N27+tlrc -input anat_ns+orig -no_ss


Catenate transformation matrices. The first one is the header data from the normalised anatomical, the second the matrix from the coregistration. These two have to be inverted (-I) because now we want to coregister the EPI pages to anatomical and then to Talairach, which is the opposite direction as the matrices where calculated. The last matrix is the realignment transformation. total_transform... is the name of the new combined transformation matrix

cat_matvec -ONELINE anat_ns+tlrc::WARP_DATA -I anat_al_mat.aff12.1D -I realign_mat.aff12.1D > total_transform_mat.aff12.1D


Apply combined transformations to the EPIs before the calculation of the spatial transformations to fit the anatomical in standard space. -mast_dxyz is set to 3 to prevent upsampling of the EPI data which only has a resolution of 3x3x3 mm here

3dAllineate -base anat_ns+tlrc -1Dmatrix_apply total_transform_mat.aff12.1D -mast_dxyz 3 -float -prefix func_trans func_tshift+orig


References

Comparison of coregistration software http://brainimaging.waisman.wisc.edu/~oakes/teaching/coreg_software_comparison.html

Huettel, S. A., Song, A.W., & McCarthy, G. (2008). Functional Magnetic Resonance Imaging (2nd edition). Sinauer Associates, Inc: Sunderland, Massachusetts, USA.