Anatomical Preprocessing

Anatomical Registration

In order to compare brain activations between subjects, individual functional and anatomical images must first be transformed to match a common template. The most commonly used template (MNI152) is maintained by the Montreal Neurological Institute, and is created by combining data from the brains of many different individuals to create an “average” brain. The image below shows how an individual brain is warped to match the shape of the template.

_images/registration.png

C-PAC provides the option of either using FSL (FLIRT and FNIRT) or Advanced Normalization Tools (ANTS) to register images. Although the use of ANTS requires an extra step during the C-PAC install process, we have found its results to be significantly better than those produced by FSL (a conclusion supported by a recent systematic analysis by Klein et al.).

During registration, individual anatomical images are first transformed to match the common template. Then, the functional data for each subject is registered to their own transformed anatomical image. Finally, functional derivative files are transformed to the common template. For more detail on how C-PAC computes these steps, please see the Registration Page of the developer documentation.

By default, C-PAC will register subject brains to the MNI152 template included with FSL. Users wishing to register their data to a different template (such as a group specific template) can specify alternative template files.

Configuring CPAC to Run Anatomical Registration

_images/anat_reg_gui.png
  1. Anatomical Template Resolution - [1mm, 2mm, 3mm, 4mm]: The resolution to which anatomical images should be transformed during registration. This is the resolution at which processed anatomical files will be output.
  2. Anatomical Template (Brain Only) - [path]: Template to be used during registration. It is not necessary to change this path unless you intend to use a non-standard template.
  3. Anatomical Template (With Skull) - [path]: Template to be used during registration. It is not necessary to change this path unless you intend to use a non-standard template.
  4. Anatomical to Template Registration Method - [ANTS, FSL, ANTS & FSL]: Registration method(s) to be used. Options are ANTS, FSL, or both.
  5. FSL FNIRT Configuration File - [path]: Configuration file specifying settings used during registration. Required if FSL is selected as the registration method. This file can be found in the /etc/flirtsch directory of your FSL install.
  6. FSL FNIRT Reference Mask - [path]: A reference mask to be used by FNIRT.
  7. Use skull-on image to calculate transform? (ANTS only) - [Off, On]: Register skull-on anatomical image to template. Calculating the transform with skull-stripped images is reported to be better, but it requires very high-quality skull-stripping. If skull-stripping is imprecise, registration with skull is preferred. Note: This option only affects ANTS due to the fact that FNIRT already uses skull-on images for calculating warps.
  8. Inputs Already Skull-stripped? - [On, Off]: Disables skull-stripping on the anatomical inputs if they are already skull-stripped.

Configuration Without the GUI

The following key/value pairs must be defined in your pipeline configuration YAML for C-PAC to run anatomical preprocessing:

Key Description Potential Values
resolution_for_anat The resolution to which anatomical images should be transformed during registration. 1mm,2mm,3mm,4mm
template_brain_only_for_anat Template to be used during registration. Normally the default value (seen in the example YAML) is fine. A path (e.g., $FSLDIR/data/standard/MNI152_T1_${resolution_for_anat}_brain.nii.gz).
template_skull_for_anat Template to be used during registration. Normally the default value (seen in the example YAML) is fine. A path (e.g., $FSLDIR/data/standard/MNI152_T1_${resolution_for_anat}_brain.nii.gz).
regOption Use either ANTS or FSL (FLIRT and FNIRT) as your anatomical registration method. A list containing ‘ANTS’, ‘FSL’, or both (e.g., [‘FSL’]).
fnirtConfig Configuration file to be used by FSL to set FNIRT parameters. A template name (e.g., ‘T1_2_MNI152_2mm’).
ref_mask Configuration file to be used by FSL to set FNIRT parameters. A path (e.g., $FSLDIR/data/standard/MNI152_T1_${resolution_for_anat}_brain_mask_dil.nii.gz).
regWithSkull Register skull-on anatomical image to a template. A list where ‘1’ represents ‘yes’ and ‘0’ represents ‘no’ (e.g., ‘[1]’).
already_skullstripped Disables skull-stripping on the anatomical inputs if they are already skull-stripped. A list where ‘1’ represents ‘yes’ and ‘0’ represents ‘no’ (e.g., ‘[1]’).

The box below contains an example of what these parameters might look like when defined in the YAML:

resolution_for_anat : 2mm
template_brain_only_for_anat : /usr/share/fsl/5.0/data/standard/MNI152_T1_${resolution_for_anat}_brain.nii.gz
template_skull_for_anat : /usr/share/fsl/5.0/data/standard/MNI152_T1_${resolution_for_anat}.nii.gz
regOption : ['ANTS']
fnirtConfig : T1_2_MNI152_2mm
ref_mask : $FSLDIR/data/standard/MNI152_T1_${resolution_for_anat}_brain_mask_symmetric_dil.nii.gz
regWithSkull : [0]
already_skullstripped : [0]

Anatomical Tissue Segmentation

C-PAC uses FSL/FAST to automatically segment brain images into white matter, gray matter, and CSF. This is done using probability maps that contain information about the likelihood that a given voxel will be of a particular tissue type. Users specify a probability threshold such that voxels meeting a minimum probability of being a particular tissue will be classified as such. This results in masks containing voxels of only a single tissue type.

_images/segmentation.png

The default tissue probability maps (referred to as Prior Probability Maps) used during segmentation are based on information from a large number of brains, and are based on the priors distributed with FSL and are included in the “Image Resource Files” package downloaded during installation. For more detail on how CPAC computes these steps, please see the Segmentation Page of the developer documentation.

If you would like to use different priors, they must first be binarized such that for each voxel the probability for each tissue type is set to either 0% or 100%.

The following bash script will binarize existing priors:

# Define what kind of priors to generate (gray, white, or csf)
tissue=gray

# Define threshold to use when binarizing data
threshold=0.5

# Copy existing priors (in this example, from FSL)
3dcopy $FSL_DIR/data/standard/tissuepriors/avg152T1_${tissue}.hdr avg152T1_${tissue}.nii.gz

# Binarize image using threshold set above
fslmaths avg152T1_${tissue}.nii.gz -thr $threshold -bin avg152T1_${tissue}_2mm_bin

Configuring CPAC to Run Anatomical Tissue Segmentation

_images/seg_gui.png
  1. Run Tissue Segmentation - [On, Off, On/Off]: Automatically segment anatomical images into white matter, gray matter, and CSF based on prior probability maps.
  2. Priors Directory - [path]: Full path to a directory containing binarized prior probability maps. These maps are included as part of the ‘Image Resource Files’ package available on the Install page of the User Guide. It is not necessary to change this path unless you intend to use non-standard priors.
  3. White Matter Prior Probability Map - [path]: Full path to a binarized White Matter prior probability map. It is not necessary to change this path unless you intend to use non-standard priors.
  4. Gray Matter Prior Probability Map - [path]: Full path to a binarized Gray Matter prior probability map. It is not necessary to change this path unless you intend to use non-standard priors.
  5. CSF Prior Probability Map - [path]: Full path to a binarized CSF prior probability map. It is not necessary to change this path unless you intend to use non-standard priors.

Configuration Without the GUI

The following key/value pairs must be defined in your pipeline configuration YAML for C-PAC to run anatomical tissue segmentation:

Key Description Potential Values
runSegmentationPreprocessing Automatically segment anatomical images into white matter, gray matter, and CSF based on prior probability maps. A list where ‘1’ represents ‘yes’ and ‘0’ represents ‘no’ (e.g., ‘[1]’).
priors_path Full path to a directory containing binarized prior probability maps. These maps are included as part of the ‘CPAC Image Resource Files’ package from installation. It is not necessary to change this path unless you intend to use non-standard priors. A path (e.g., $FSLDIR/data/standard/tissuepriors/${resolution_for_anat}).
PRIORS_WHITE Full path to a binarized White Matter prior probability map. It is not necessary to change this path unless you intend to use non-standard priors. A path (e.g., $priors_path/avg152T1_white_bin.nii.gz).
PRIORS_GRAY Full path to a binarized Gray Matter prior probability map. It is not necessary to change this path unless you intend to use non-standard priors. A path (e.g., $priors_path/avg152T1_gray_bin.nii.gz).
PRIORS_CSF Full path to a binarized CSF prior probability map. It is not necessary to change this path unless you intend to use non-standard priors. A path (e.g., $priors_path/avg152T1_csf_bin.nii.gz).

The box below contains an example of what these parameters might look like when defined in the YAML:

runSegmentationPreprocessing : [1]
priors_path : /usr/share/fsl/5.0/data/standard/tissuepriors/${resolution_for_anat}
PRIORS_WHITE : $priors_path/avg152T1_white_bin.nii.gz
PRIORS_GRAY : $priors_path/avg152T1_gray_bin.nii.gz
PRIORS_CSF : $priors_path/avg152T1_csf_bin.nii.gz