Segmentation of hippocampal subfields

This functionality is present in FreeSurfer 6.0 and later

Author: Juan Eugenio Iglesias

E-mail: iglesias [at] nmr.mgh.harvard.edu

Rather than directly contacting the author, please post your questions on this module to the FreeSurfer mailing list at freesurfer [at] nmr.mgh.harvard.edu

If you use these tools in your analysis, please cite:


Contents

  1. Motivation and General Description
  2. Installation
  3. Usage
  4. Gathering the volumes from all analyzed subjects
  5. Frequently asked questions


1. Motivation and General Description

This tool generates an automated segmentation of the hippocampal subfields based on a statistical atlas built primarily upon ultra-high resolution (~0.1 mm isotropic) ex vivo MRI data. This new method can take advantage high-resolution, dedicated images when available (typically, but not necessarily, T2 weighted), and solves a number of limitations of the in vivo atlas that was distributed with FreeSurfer 5.1-5.3, namely:

(a) The image resolution of the training data used to built the atlas was insufficient for the human labelers to completely distinguish the subfields, forcing them to heavily rely on geometric criteria to trace boundaries, which affected the accuracy of their annotations. On the ex vivo images, several of these boundaries are much better visualized, so the annotations are much more reliable.

(b) Related to (a): a problematic consequence of the lack of resolution in the in vivo data was that the manual delineation protocol did not include the “molecular layer”, which corresponds to the stratum radiatum, lacunosum moleculare, hippocampal sulcus and molecular layer of the dentate gyrus, and which is also known as “dark band” due to its hypointense appearance in T2 MRI. The absence of the “molecular layer” in the atlas compromised the ability of the atlas to segment high-resolution in vivo data, since this layer is the key appearance feature describing the internal structure of the hippocampus. The new, ex vivo atlas does include this layer in the model.

(c) The delineation protocol of the in vivo atlas was designed for the hippocampal body and did not translate well to the hippocampal head or tail. The new atlas was created with a new, specifically designed labeling protocol.

(d) Due to issues (a), (b), and (c), the volumes of the subfield in the in vivo atlas did not agree well with those from histological studies (Simic, et al., 1997, Harding, et al., 1998). The volumes derived from the new atlas agree much better with these studies (see the Neuroimage paper).

Here is a coronal slice of a sample T1-weighted 1 mm scan and the corresponding segmentations given by FreeSurfer 5.3 and FreeSurfer 6.0:


samples1.png

And here is is a coronal slice of a sample T2-weighted scan with 0.4 mm in-plane resolution (coronal) and 2 m slice thickness, along with the segmentation given by FreeSurfer 6.0 (FreeSurfer 5.3 could not be used to segment such scans):


samples2.png

2. Installation

The hippocampal subfield module requires the Matlab R2012 runtime; the runtime is free, and therefore NO MATLAB LICENSES ARE REQUIRED TO USE THIS SOFTWARE. Please note that, if you have already installed the runtime for the brainstem module, you do not need to install it again. Instructions for the installation of the runtime can be found here:

https://surfer.nmr.mgh.harvard.edu/fswiki/MatlabRuntime


3. Usage

This software has three modes of operation, depending on whether you only have a standard 1 mm T1 scan or you have an additional MRI volume containing the hippocampus (ideally of higher resolution).

All you need is to append the flag -hippocampal-subfields-T1 to your recon-all command. For example, to analyze your subject "bert", you would type:

recon-all -all -s bert -hippocampal-subfields-T1 

Or, if Bert has already undergone the FreeSurfer pipeline (recon-all -all), you can just run:

recon-all -s bert -hippocampal-subfields-T1 

The output will consist of six files (three for each hemisphere) that can be found under the subject's mri directory (in this example, $SUBJECTS_DIR/bert/mri/):

[lr]h.hippoSfLabels-T1.v10.mgz: they store the discrete segmentation volume (lh for the left hemisphere, rh for the righ) at 0.333 mm resolution.

[lr]h.hippoSfLabels-T1.v10.1mm.mgz: they store the discrete segmentation volume in the 1 mm FreeSurfer voxel space.

[lr]h.hippoSfVolumes-T1.v10.txt: these text files store the estimated volumes of the subfields and of the whole hippocampi.

Note that [lr]h.hippoSfLabels-T1.v10.mgz covers only a patch around the hippocampus, at a higher resolution than the input image. The segmentation and the image are defined in the same physical coordinates, so you can visualize them simultaneously with (run from the subject's mri directory):

freeview -v nu.mgz -v lh.hippoSfLabels-T1.v10.mgz:colormap=lut -v rh.hippoSfLabels-T1.v10.mgz:colormap=lut

On the other hand [lr]h.hippoSfLabels-T1.v10.1mm.mgz lives in the same voxel space as the other FreeSurfer volumes (e.g., orig.mgz, nu.mgz, aseg.mgz) , but its resolution is lower than that of [lr]h.hippoSfLabels-T1.v10.mgz.


If an additional MRI volume (e.g., a T2 scan, but it could be proton density, or even another T1) covering the hippocampi is available, we can use it to obtain a more reliable segmentation - particularly in the case in which its resolution is higher than 1 mm (even if anisotropic). In this case, the only requirement is that the additional scan is in the same orientation as the 1 mm T1 scan and coarsely aligned to it.

The are two sub-modes of operation, depending on whether we want to use the standard resolution T1 and the additional scan simultaneously in the segmentation (multispectral analysis), or if we only want to use the additional scan. The former is advised when the additional scan is of comparable resolution as the T1 scan (e.g., a 1x1x1 mm T2 volume) or when it does not cover the whole hippocampal region - in that case, the T1 information will be critical to segment the hippocampal regions outside the field of view of the additional volume (see for instance Figure 12e in the Neuroimage paper). The latter is advised when the additional scan is of higher resolution than the T1 volume and it covers the whole hippocampal region. The corresponding commands would be:

recon-all -s <subject_name> -hippocampal-subfields-T1T2 <file name of additional scan> <analysisID>

recon-all -s <subject_name> -hippocampal-subfields-T2 <file name of additional scan>  <analysisID> 

The string <analysisID> is a user defined identifier that makes it possible to run different analysis with different types of additional scans. For example, you can run the command with a T2-weighted volume and use the identifier "T2", and then run it again with a PD-weighted volume and use the identifier "PD", such that both results will coexist in the subject's mri directory (see naming convention for the generated output below).

These commands generate the following outputs:

<analysisID>.FSspace.mgz: the additional scan, rigidly registered to the T1 data.

[lr]h.hippoSfLabels-<T1>-<analysisID>.v10.mgz: they store the discrete segmentation volume at 0.333 mm resolution in the physical space of the FreeSurfer T1 data (and therefore of the aligned scan <analysisID>.FSspace.mgz as well).

[lr]h.hippoSfLabels-<T1>-<analysisID>.v10.1mm.mgz: they store the discrete segmentation volume in the 1 mm FreeSurfer voxel space.

[lr]h.hippoSfVolumes-<T1>-<analysisID>.v10.txt: these text files store the estimated volumes of the subfields and of the whole hippocampi.

In order to visualize these outputs: let's say that you have run an analysis with id T2ADNI. Then, you can run:

freeview -v nu.mgz -v T2ADNI.FSspace.mgz:sample=cubic \
-v lh.hippoSfLabels-T1-T2ADNI.v10.mgz:colormap=lut -v rh.hippoSfLabels-T1-T2ADNI.v10.mgz:colormap=lut

* Only additional scan

freeview -v nu.mgz -v T2ADNI.FSspace.mgz:sample=cubic \
-v lh.hippoSfLabels-T2ADNI.v10.mgz:colormap=lut -v rh.hippoSfLabels-T2ADNI.v10.mgz:colormap=lut


4. Gathering the volumes from all analyzed subjects

Once this module has been run on a number of subjects, it is possible to collect the volumes of the hippocampal substructures from all the subjects and write them to a single file - which can be easily read with a spreadsheet application. To do so, one would run:

quantifyHippocampalSubfields.sh <T1>-<analysisID> <output_file> <OPTIONAL_subject_directory>  

The first argument is the name of the analysis. For Mode A (i.e., based on 1mm T1 scan), it is simply T1. For Mode B, it would be T1-<analysisID> (for multispectral analysis) or just <analysisID> (for segmentation based only on the additional scan). The argument <output_file> corresponds to the text file where the table with the volumes will be written. The fields are separated by spaces. Finally, the third argument corresponds to the FreeSurfer subjects directory that we want to analyze. This argument is not necessary if the environment variable SUBJECTS_DIR has been defined.


5. Frequently asked questions (FAQ)

The software uses compiled Matlab code that requires the free runtime, but no licenses. So, if you have a computer cluster, you can run hundred of segmentations in parallel without having to worry about Matlab licenses. And yes, this is all perfectly legal ;-)

This is because the volumes are computed upon a soft segmentation, rather than the discrete segmentation in discreteLabels.mgz. This is the same that happens with the main recon-all stream: if you compute volumes by counting voxels in aseg.mgz, you don't get the values reported in aseg.stats.

The segmentation discreteLabels.mgz covers only a patch around the hippocampus, at a higher resolution than the input image. The segmentation and the image are defined in the same physical coordinates, so you can visualize them simultaneously with (assuming analysis based on T1 image only):

cd $SUBJECTS_DIR/<subject_name>/mri/

freeview -v nu.mgz -v subfieldAnalysis_T1_v1.0/left/discreteLabels.mgz:colormap=lut subfieldAnalysis_T1_v1.0/right/discreteLabels.mgz:colormap=lut 

Or, if you used an additional scan:

freeview -v <file name of additional scan> -v subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/left/discreteLabels.mgz:colormap=lut subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/right/discreteLabels.mgz:colormap=lut

If you want to resample the segmentation to the 1 mm FreeSurfer voxel space, you can run the command:

mri_convert  subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabels.mgz  subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side> /discreteLabelsResampledT1.mgz -rt nearest -rl nu.mgz -odt float

Or, if you want to resample it to the voxel space of the additional scan:

mri_convert  subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabels.mgz  subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabelsResampledAddScan.mgz -rt nearest -rl <name_of_additional_scan> -odt float

Indeed! The deformation of the atlas towards the input scan(s) is parallelized. If you want to limit the number of cores that the software is allowed to use, you simply need to set the environment variable ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS. For example, to limit the number of used cores to 2 in tcsh or csh:

setenv ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS 2

Or, in bash:

export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=2

If the input is just the standard resolution (1mm) T1 data from the main FreeSurfer pipeline, then the software requires approximately 10GB of RAM memory to run. If additional scans are used, then the exact amount of required RAM memory depends on the size and resolution of the additional scan.

Yes! The reason for this is that the volumes correspond to two different analyses. We have found the estimates from this module to be slightly more accurate than FreeSurfer's (see paper).

Any format supported by FreeSurfer, including Nifti (.nii/.nii.gz), DICOM, MICN (.mnc) and FreeSurfer format (.mgh/.mgz).

This is because the additional scan is frequently a coronal T2 with high in-plane resolution but large slice separation, so it is more accurate to resample the isotropic T1 to the T2 space rather than the other way around. In any case, the software computes a transform than maps the space of the isotropic FreeSurfer image volumes to the space of the additional scan. This transform is available at:

If you want the segmentation to be aligned with the 1mm T1 scan, you have two options, to resample or not to resample. If you want to resample to the voxel space of the 1 mm T1, you can run the following command:

cd $SUBJECTS_DIR/<subject_name>/mri/

mri_convert subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabels.mgz subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabelsResampledT1.mgz -rt nearest -rl nu.mgz -ait transforms/T1_to_<name_of_additional_file>.refined.<side>.lta  -odt float

where “ait” stands for “apply inverse transform”. If you want to warp without resampling in order to preserve the resolution of the segmentation, you can run these commands instead:

cd $SUBJECTS_DIR/<subject_name>/mri/

 mri_vol2vol --mov subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabels.mgz --o subfieldAnalysis<_T1>_<file name of additional scan>_v1.0/<side>/discreteLabelsT1spaceNoResampled.mgz --targ nu.mgz --lta-inv transforms/T1_to_<name_of_additional_file>.refined.<side>.lta  --no-resample