ftadel / IntrAnat

sEEG software
GNU General Public License v3.0
2 stars 1 forks source link

New atlas: HCP-MMP1 subject space (FreeSurfer custom commands) #7

Open ftadel opened 3 years ago

ftadel commented 3 years ago

The HCP-MMP1 atlas is not really supposed to be used as a MNI atlas. Instead, we should use subject-space FreeSurfer surface parcellations. Source:

In IntrAnat, we haven't implemented the direct use of FreeSurfer .annot file, and we can't work directly in fsaverage space. Therefore we need to project the .annot files (surface parcellations) to the subject space, and then interpolate these surface parcellations into the volume.

I came up with this sequence of FreeSurfer commands below, to be executed after downloading the HCP-MMP1 .annot files (https://figshare.com/articles/dataset/HCP-MMP1_0_projected_on_fsaverage/3498446?file=5528837)

export subjid=...
export subdir=$SUBJECTS_DIR/$subjid

# If the subject freesurfer segmentation is not in $SUBJECTS_DIR, create a link first
# ln -s "/home/ftadel/IntrAnat/localSubj/0001BAR - 27_11_2016/freesurfer" $subdir

# Project annot files from fsaverage to subject (left and right hemispheres separately)
mri_surf2surf --srcsubject fsaverage --trgsubject $subjid --hemi lh   --sval-annot /path/to/lh.HCP-MMP1.annot  --tval $subdir/label/lh.HCP-MMP1.annot
mri_surf2surf --srcsubject fsaverage --trgsubject $subjid --hemi rh   --sval-annot /path/to/rh.HCP-MMP1.annot  --tval $subdir/label/rh.HCP-MMP1.annot

# Convert from .annot to aseg.mgz volume (left hemi = original labels ; right hemi = 200 + original labels)
mri_surf2volseg --o $subdir/mri/HCP-MMP1+aseg.mgz --label-cortex --i $subdir/mri/aseg.mgz --threads 1 --lh-annot $subdir/label/lh.HCP-MMP1.annot 0 --lh-cortex-mask $subdir/label/lh.cortex.label --lh-white $subdir/surf/lh.white --lh-pial $subdir/surf/lh.pial --rh-annot $subdir/label/rh.HCP-MMP1.annot 200 --rh-cortex-mask $subdir/label/rh.cortex.label --rh-white $subdir/surf/rh.white --rh-pial $subdir/surf/rh.pial 

# Constrain to cortical ribbon (and remove the rest of the ASEG stuff)
mri_concat --combine --i $subdir/mri/lh.ribbon.mgz --i $subdir/mri/rh.ribbon.mgz --o $subdir/mri/ribbon_lr.mgz
mri_mask $subdir/mri/HCP-MMP1+aseg.mgz $subdir/mri/ribbon_lr.mgz $subdir/mri/HCP-MMP1.mgz

# Delete link if you created one
# rm $subdir

The idea of using mri_surf2volseg came from here: https://www.mail-archive.com/search?l=freesurfer@nmr.mgh.harvard.edu&q=subject:%22Re%5C%3A+%5C%5BFreesurfer%5C%5D+HCPMMP1+parcellation+to+aseg+%5C%28.mgz%5C%29%22&o=newest&f=1

ftadel commented 3 years ago

Import of the subject-level DKT and HCP-MMP1: https://github.com/ftadel/IntrAnat/commit/ca6ef826a5adb19ac2cd81901e1c4ad661052b79

@manikbh In order to add new these new files into the existing patients in the f-tract database, you can probably import ImageImport.py and call function importFsAtlas(). Example:

imgImport.importFsAtlas('0001BAR', 'Epilepsy', 'DKT', '/path/to/freesurfer/mri/aparc.DKTatlas+aseg.mgz')
imgImport.importFsAtlas('0001BAR', 'Epilepsy', 'HCP-MMP1', '/path/to/freesurfer/mri/HCP-MMP1.mgz')