- Categories:
- neuroscience
- Tags:
- afni, atlas, destrieux, fmri, freesurfer, neuroscience, parcellation, roi, volumetric
Performing a region of interest analysis on MRI requires knowing where the regions are in your subject data. Typically, this has been done using hand-drawn masks in a 3d viewer. However, recent research has made the process mostly automatic and the open-source community has implemented everything you will need to automatically create labeled volumetric regions of interest [1-3]. With FreeSurfer 5.3, we have the option of performing cortical parcellation using 4 different atlases:
Destrieux atlas: aparc.a2009s
Desikan-Killiany atlas: aparc
Mindboggle: aparc.DKTatlas40
Brodman areas: BA and BA.thresh
We’ll first use freesurfer’s recon-all tool to perform a cortical reconstruction of our anatomical scans. Download freesurfer and register your copy. You’ll be sent an e-mail with a license. Follow the instructions and create the license file “.license” inside your freesurfer home directory (check the environment variable, FREESURFER_HOME, e.g., “$ echo $FREESURFER_HOME"). Then run the script, “$FREESURFER_HOME/FreeSurferEnv.sh” to setup necessary paths.
Next make sure you have set the environment variable for SUBJECTS_DIR to where you’d like your analysis to go (e.g., “$ export SUBJECTS_DIR=/some/directory“). For our example, we’ll keep this to a directory called “freesurfer” in our home directory, “~/”. Each subject we analyze will have its own folder insider SUBJECTS_DIR (i.e., “~/freesurfer”, for our example), with the name specified by recon-all’s “subjid” parameter. We’ll come back to that if it doesn’t make sense yet.
We’re ready to run recon-all now. It can take up to 12 hours on a new machine. Since we have a few subjects, we used our computing cluster to perform the analysis. The cluster we use requires us to submit jobs to a queue using qsub. This bash script file will loop through all our subjects and run recon-all on each of them using a new “job” submitted through qsub. Our subject’s anatomical data is stored in a Nifti file format, “.nii”, in the directory ~/anatomical.
# set the environment variable to where our subject data will be stored export SUBJECTS_DIR=~/freesurfer # these are the names of the subjects for which we have high-res scans for declare -a arr=("15jul13rr" "16jul13ad" "17jul13bs" "18jul13ys") # we are going to use this temporary directory while processing data mkdir /global/scratch/pkm # loop through our subjects for i in "${arr[@]}" do echo "$i" # copy the scan to the temp directory datasetlocation=/global/scratch/pkm/"$i"_anat.nii cp ../anatomical/"$i"_anat.nii $datasetlocation # subject a job with the current subject's file qsub -v subject=$i,location=$datasetlocation run_freesurfer.pbs doneThis pbs file is our job script which takes one subject’s mri data and runs
recon-allon it.#!/bin/bash -l # Name your job (used in the PBS output file names) #PBS -N $subject # request the queue (enter the possible names, if omitted, serial is the default) #PBS -q default # request 1 node and request 1 processor per node #PBS -l nodes=1:ppn=1 # Specify how much time you think the job will run #PBS -l walltime=36:00:00 # By default, PBS scripts execute in your home directory, not the # directory from which they were submitted. The following line # places you in the directory from which the job was submitted. cd $PBS_O_WORKDIR # Set the environment variable again as this is on another machine export SUBJECTS_DIR=~/freesurfer # Filename for logging filename="$LOGID"_`date +%Y%m%d-%H%M%S`_freesurfer.log # Run recon-all recon-all -i $location -subjid $subject -all &> logs/$filenameIf you don’t have a cluster, the line to perform is simply:
recon-all -i YOUR_NIFTI_DATA.nii -subjid SOME_IDENTIFIER -allwhere YOUR_NIFTI_DATA may be something like ’15julrr_anat.nii’, and SOME_IDENTIFIER could be ’15julrr’. This identifier is the directory which will be created inside SUBJECTS_HOME.
Next we’ll make use of AFNI’s toolset (free download here). The first is @SUMA_Make_Spec_FS, which will prepare analysis for
sumaand store the results inside the subject’s surf directory in its own folder, SUMA. This process takes about 15-30 minutes. We then use@SUMA_AlignToExperimentto re-align our data and labels.Finally, we are ready to extract VOIs. We’ll use
whereamito do this. We first find what the name of our region is within our atlas code:$ whereami -show_atlases $ whereami -show_atlas_code -atlas ATLAS_CODEwhere ATLAS_CODE is an atlas identifier from the output of show_atlases. If we use, “aparc.a2009s+aseg_rank”, then we are using the Destrieux’s Atlas (see here), and we can see the codes for our atlas like so:
$ whereami -show_atlas_code -atlas aparc.a2009s+aseg_rank ++ Input coordinates orientation set by default rules to RAI Atlas aparc.a2009s+aseg_rank, 194 regions ----------- Begin regions for aparc.a2009s+aseg_rank atlas----------- l:Left-Cerebellum-White-Matter:4 l:Left-Hippocampus:13 r:Right-choroid-plexus:34 u:ctx_lh_G_cingul-Post-ventral:55 u:ctx_lh_G_rectus:76 u:ctx_lh_S_front_inf:97 u:ctx_lh_S_oc_sup_and_transversal:103 u:ctx_rh_G_and_S_transv_frontopol:124 u:ctx_rh_G_pariet_inf-Supramar:145 u:ctx_rh_S_circular_insula_ant:166 u:ctx_rh_S_precentral-inf-part:187 l:Left-Cerebellum-Cortex:5 l:Left-Amygdala:14 u:5th-Ventricle:35 u:ctx_lh_G_cuneus:56 u:ctx_lh_G_subcallosal:77 u:ctx_lh_S_front_middle:98 u:ctx_lh_S_occipital_ant:104 u:ctx_rh_G_and_S_cingul-Ant:125 u:ctx_rh_G_parietal_sup:146 u:ctx_rh_S_circular_insula_inf:167 u:ctx_rh_S_precentral-sup-part:188 l:Left-Thalamus-Proper:6 u:CSF:15 u:WM-hypointensities:36 u:ctx_lh_G_front_inf-Opercular:57 u:ctx_lh_G_temp_sup-G_T_transv:78 u:ctx_lh_S_front_sup:99 u:ctx_lh_S_oc-temp_lat:105 u:ctx_rh_G_and_S_cingul-Mid-Ant:126 u:ctx_rh_G_postcentral:147 u:ctx_rh_S_circular_insula_sup:168 u:ctx_rh_S_suborbital:189 l:Left-Caudate:7 l:Left-Accumbens-area:16 u:non-WM-hypointensities:37 u:ctx_lh_G_front_inf-Orbital:58 u:ctx_lh_G_temp_sup-Lateral:79 u:ctx_lh_S_oc-temp_med_and_Lingual:106 u:ctx_rh_G_and_S_cingul-Mid-Post:127 u:ctx_rh_G_precentral:148 u:ctx_rh_S_collat_transv_ant:169 u:ctx_rh_S_subparietal:190 l:Left-Putamen:8 l:Left-VentralDC:17 u:Optic-Chiasm:38 u:ctx_lh_G_front_inf-Triangul:59 u:ctx_lh_G_temp_sup-Plan_polar:80 u:ctx_lh_S_orbital_lateral:107 u:ctx_rh_G_cingul-Post-dorsal:128 u:ctx_rh_G_precuneus:149 u:ctx_rh_S_collat_transv_post:170 u:ctx_rh_S_temporal_inf:191 l:Left-Pallidum:9 l:Left-vessel:18 u:CC_Posterior:39 u:ctx_lh_G_front_middle:60 u:ctx_lh_G_temp_sup-Plan_tempo:81 u:ctx_lh_S_orbital_med-olfact:108 u:ctx_rh_G_cingul-Post-ventral:129 u:ctx_rh_G_rectus:150 u:ctx_rh_S_front_inf:171 u:ctx_rh_S_temporal_sup:192 l:Left-choroid-plexus:19 u:CC_Mid_Posterior:40 u:ctx_lh_G_front_sup:61 u:ctx_lh_G_temporal_inf:82 u:ctx_lh_S_orbital-H_Shaped:109 u:ctx_rh_G_cuneus:130 u:ctx_rh_G_subcallosal:151 u:ctx_rh_S_front_middle:172 u:ctx_rh_S_temporal_transverse:193 r:Right-Cerebral-White-Matter:20 u:CC_Central:41 u:ctx_lh_G_Ins_lg_and_S_cent_ins:62 u:ctx_lh_G_temporal_middle:83 u:ctx_lh_S_parieto_occipital:110 u:ctx_rh_G_front_inf-Opercular:131 u:ctx_rh_G_temp_sup-G_T_transv:152 u:ctx_rh_S_front_sup:173 r:Right-Lateral-Ventricle:21 u:CC_Mid_Anterior:42 u:ctx_lh_G_insular_short:63 u:ctx_lh_Lat_Fis-ant-Horizont:84 u:ctx_lh_S_pericallosal:111 u:ctx_rh_G_front_inf-Orbital:132 u:ctx_rh_G_temp_sup-Lateral:153 u:ctx_rh_S_interm_prim-Jensen:174 r:Right-Inf-Lat-Vent:22 u:CC_Anterior:43 u:ctx_lh_G_occipital_middle:64 u:ctx_lh_Lat_Fis-ant-Vertical:85 u:ctx_lh_S_postcentral:112 u:ctx_rh_G_front_inf-Triangul:133 u:ctx_rh_G_temp_sup-Plan_polar:154 u:ctx_rh_S_intrapariet_and_P_trans:175 r:Right-Cerebellum-White-Matter:23 u:ctx-lh-unknown:44 u:ctx_lh_G_occipital_sup:65 u:ctx_lh_Lat_Fis-post:86 u:ctx_lh_S_precentral-inf-part:113 u:ctx_rh_G_front_middle:134 u:ctx_rh_G_temp_sup-Plan_tempo:155 u:ctx_rh_S_oc_middle_and_Lunatus:176 r:Right-Cerebellum-Cortex:24 u:ctx-rh-unknown:45 u:ctx_lh_G_oc-temp_lat-fusifor:66 u:ctx_lh_Pole_occipital:87 u:ctx_lh_S_precentral-sup-part:114 u:ctx_rh_G_front_sup:135 u:ctx_rh_G_temporal_inf:156 u:ctx_rh_S_oc_sup_and_transversal:177 r:Right-Thalamus-Proper:25 u:ctx_lh_G_and_S_frontomargin:46 u:ctx_lh_G_oc-temp_med-Lingual:67 u:ctx_lh_Pole_temporal:88 u:ctx_lh_S_suborbital:115 u:ctx_rh_G_Ins_lg_and_S_cent_ins:136 u:ctx_rh_G_temporal_middle:157 u:ctx_rh_S_occipital_ant:178 r:Right-Caudate:26 u:ctx_lh_G_and_S_occipital_inf:47 u:ctx_lh_G_oc-temp_med-Parahip:68 u:ctx_lh_S_calcarine:89 u:ctx_lh_S_subparietal:116 u:ctx_rh_G_insular_short:137 u:ctx_rh_Lat_Fis-ant-Horizont:158 u:ctx_rh_S_oc-temp_lat:179 r:Right-Putamen:27 u:ctx_lh_G_and_S_paracentral:48 u:ctx_lh_G_orbital:69 u:ctx_lh_S_central:90 u:ctx_lh_S_temporal_inf:117 u:ctx_rh_G_occipital_middle:138 u:ctx_rh_Lat_Fis-ant-Vertical:159 u:ctx_rh_S_oc-temp_med_and_Lingual:180 r:Right-Pallidum:28 u:ctx_lh_G_and_S_subcentral:49 u:ctx_lh_G_pariet_inf-Angular:70 u:ctx_lh_S_cingul-Marginalis:91 u:ctx_lh_S_temporal_sup:118 u:ctx_rh_G_occipital_sup:139 u:ctx_rh_Lat_Fis-post:160 u:ctx_rh_S_orbital_lateral:181 r:Right-Hippocampus:29 u:ctx_lh_G_and_S_transv_frontopol:50 u:ctx_lh_G_pariet_inf-Supramar:71 u:ctx_lh_S_circular_insula_ant:92 u:ctx_lh_S_temporal_transverse:119 u:ctx_rh_G_oc-temp_lat-fusifor:140 u:ctx_rh_Pole_occipital:161 u:ctx_rh_S_orbital_med-olfact:182 u:Unknown:0 r:Right-Amygdala:30 u:ctx_lh_G_and_S_cingul-Ant:51 u:ctx_lh_G_parietal_sup:72 u:ctx_lh_S_circular_insula_inf:93 u:ctx_rh_G_and_S_frontomargin:120 u:ctx_rh_G_oc-temp_med-Lingual:141 u:ctx_rh_Pole_temporal:162 u:ctx_rh_S_orbital-H_Shaped:183 l:Left-Cerebral-White-Matter:1 u:3rd-Ventricle:10 r:Right-Accumbens-area:31 u:ctx_lh_G_and_S_cingul-Mid-Ant:52 u:ctx_lh_G_postcentral:73 u:ctx_lh_S_circular_insula_sup:94 u:ctx_lh_S_interm_prim-Jensen:100 u:ctx_rh_G_and_S_occipital_inf:121 u:ctx_rh_G_oc-temp_med-Parahip:142 u:ctx_rh_S_calcarine:163 u:ctx_rh_S_parieto_occipital:184 l:Left-Lateral-Ventricle:2 u:4th-Ventricle:11 r:Right-VentralDC:32 u:ctx_lh_G_and_S_cingul-Mid-Post:53 u:ctx_lh_G_precentral:74 u:ctx_lh_S_collat_transv_ant:95 u:ctx_lh_S_intrapariet_and_P_trans:101 u:ctx_rh_G_and_S_paracentral:122 u:ctx_rh_G_orbital:143 u:ctx_rh_S_central:164 u:ctx_rh_S_pericallosal:185 l:Left-Inf-Lat-Vent:3 u:Brain-Stem:12 r:Right-vessel:33 u:ctx_lh_G_cingul-Post-dorsal:54 u:ctx_lh_G_precuneus:75 u:ctx_lh_S_collat_transv_post:96 u:ctx_lh_S_oc_middle_and_Lunatus:102 u:ctx_rh_G_and_S_subcentral:123 u:ctx_rh_G_pariet_inf-Angular:144 u:ctx_rh_S_cingul-Marginalis:165 u:ctx_rh_S_postcentral:186 ----------- End regions for aparc.a2009s+aseg_rank atlas --------------To extract one of these regions as a mask, we can use whereami:
$ whereami -atlas aparc.a2009s+aseg_rank_Alnd_Exp -mask_atlas_region aparc.a2009s+aseg_rank_Alnd_Exp::ctx_lh_G_temporal_middle -prefix lh.mtg.al+origMore reading:
http://brainybehavior.com/neuroimaging/2010/05/converting-cortical-labels-from-freesurfer-to-volumetric-masks/
http://blog.cogneurostats.com/?p=268
http://blog.cogneurostats.com/?p=217
http://neuroimage.usc.edu/brainstorm/Tutorials/LabelFreeSurferReferences:
[1]. Destrieux, C., Fischl, B., Dale, A., & Halgren, E. (2010). Automatic parcellation of human cortical gyri and sulci using standard anatomical nomenclature. Neuroimage, 53(1), 1–15. doi:10.1016/j.neuroimage.2010.06.010.Automatic[2]. Fischl et al. (2004). Automatically Parcellating the Human Cerebral Cortex. Cerebral Cortex, 14:11-22.
[3]. Desikan et al. (2006). An automated labeling system for subdividing the human cerebral cortex on MRI scans into gyral based regions of interest. NeuroImage, 31(3):968-80.
Notes:
Many thanks to Beau Sievers and Carolyn Parkinson for their help in this process.