Skip to content

Automatic segmentation of MRI hippocampal volumes along the longitudinal axis

License

Notifications You must be signed in to change notification settings

garikoitz/hippovol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated segmentation of the human hippocampus along its longitudinal axis.

This code was created to automatically segment MRI hippocampal T1-w images. The hippocampal images are segmented from the brain either manually or using tools available in the communty such as Freesurfer (already tested) or FSL.

We are upgrading the code, for prompt request contact me at:

Garikoitz Lerma-Usabiaga: garikoitz@gmail.com

Althought the main focus of the development of the tool has been the hippocampus, it can be applied to any c-shaped elongated structure, such as the corpus callosum.

The code has been use to generate all the data in the following paper (if you use this tool please cite it as):

Lerma-Usabiaga, G., Iglesias, J.E., Insausti, R., Greve, D., & Paz-Alonso. P.M. (2016). Automated segmentation of the human hippocampus along its longitudinal axis. Human Brain Mapping. Link

Requirements and installation:

HOW-TO: Short Version

1. Obtain the main hippocampal segmentation from Freesurfer's aseg.

  • Extract the hippocampal labels from Freesurfer's aseg. Assuming that you are always located in the SUBJECTS_DIR of your project:
  • mri_extract_label <SUBJECT_NAME>/mri/aseg.mgz 17 <SUBJECT_NAME>/mri/lh.asegHippo.mgz
  • mri_extract_label <SUBJECT_NAME>/mri/aseg.mgz 53 <SUBJECT_NAME>/mri/rh.asegHippo.mgz
  • To extract the whole corpus callosum, you can use this code: -- mri_extract_label <SUBJECT_NAME>/mri/aseg.mgz 251 252 253 254 255 <SUBJECT_NAME>/mri/cc_whole.mgz

Sample code to extract the aseg hippocampi (run matlab from command line with FREESURFER_HOME defined):

basedir = pwd;
sub = dir('S_*');  % Edit the wildcard to select your subjects 
hemis = {'lh', 'rh'};
labelNos = {'17', '53'};
for h=1:2
    hemi = hemis{h};
    label = labelNos{h};
    for ns=1: length(sub)
        cmd = ['mri_extract_label ' ...
               basedir filesep sub(ns).name filesep 'mri' filesep 'aseg.mgz ' label ' ' ...
               basedir filesep sub(ns).name filesep 'mri' filesep hemi '.asegHippo.mgz'];
        system(cmd);
    end
end
  • This will create the lh.asegHippo.mgz and rh.asegHippo.mgz inside the mri folder of each subject in your experiment.
  • Do quality check in this step: if aseg didn't do a good job remove the subject.

1.b If you want to use the FS6 hippocampal subfields

  • Select orig_datos = 'fs6T1' in the file hip_run.m
  • In the hip_InitMethod.m file, comment the subfields you are not interested in.
  • By default, these are the subfields included in the new hippocampi:
                            '201' % alveus
                            '203' % parasubiculum
                            '204' % presubiculum
                            '205' % subiculum
                            '206' % CA1
                            '207' % CA2
                            '208' % CA3
                            '209' % CA4
                            '210' % GC-DG
                            % '211' % HATA
                            '212' % fimbria
                            '214' % molecular_layer_HP
                            % '215' % hippocampal_fissure
                            '226' % HP_tail
  • The hip_sum_hippo_subfieldsfs6.m function will extract using the 'mri_extract_label' function the labes not commented above from the ?h.hippoSfLabels-T1.v10.mgz file and create a new file with just 0-s and 1-s, that will be segmented.

2. Run the segmentation

  1. Go to the SUBJECTS_DIR in Matlab
  2. Write in the command line: edit hip_run.m
  3. Edit at least the wildcard to detect all your subjects in the folder, the rest of the short version options are explained in the file.
  4. Run hip_run

OUTPUT:

  • The stat file will be a csv file in SUBJECTS_DIR/hippovol/. The name of the file will differ depending on the options used.
  • If the option to write the volumes was selected, every subject will have its segmented hippocampus under the mri folder. The resulting labels (HEAD, BODY, TAIL, POSTERIOR) will be stored in every subjects mri folder with .mgz extension.

HOW-TO: Long Version (to do)

This code has been used to generate all the data in the above mentioned paper, and it allows the selection of many more options, but almost for everybody the short version should be enough.

Every available option in the Long Version should be explained in the Long Version section of hip_run.m.

  • NOTE 1: You will be able to select other methods than aseg. We've already used other options: for example, adding all the hippo-subfields from version FS 5.3. The resulting hippocampus is a little bit more refined than the original aseg version. When FS 6.0 is out we will use the results of the new hippo-subfields code to create new and more refined whole hippocampi by default.
  • NOTE 2: It is possible to use the method to rotate the hippocampi, and then select the landmark manually. It will be explained how to write an .csv file with the landmark values and how to perform the segmentation using these values.
  • NOTE 3: There is a beta version of a compiled and Dockerized version available. We will update it and upload it here after the FS 6.0 version is updated.

TODOs:

  • Finish documenting long version options in hip_run.m
  • Extract hipposubfields with FS6 and create whole hippocampus automatically out of it as a default.
  • Publish compiled and Dockerized version

About

Automatic segmentation of MRI hippocampal volumes along the longitudinal axis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages