This notebook contains the scripts for generating masks defining ROIs used for decoding analyses in the DKsort experiment.
It actaully consistes of a number of bash scripts executing the make_masks.py
program that is part of lyman.
The ROIs for this project were all drawn from a population atlas of task-independent networks (Yeo et al. 2011). The labels were originally defined on the cortical surface of the Freesurfer average subject (fsaverage
). These source labels were extracted (manually, using tksurfer
) from the 17 Network parcellation availible on the Freesurfer website.
The ROIs are mapped to individual subjects using the following steps:
Warp the ROI labsls to the native surfaces using the curvature-based registration from recon-all
Linearly transform the coordinates to align with the functional data by inverting the BBRegister
matrix
Project half the cortical thickness from each vertex in the ROI and label all intersected voxels in the native functional space
Ideally, this approach generates ROIs that best represent the location of the region in each subject's brain and minmizes the inclusion of voxels from outside gray matter. The first objective is, of course, dependent on the relationship between the functional region and the macroanatomical structures used in the surface transformation. Note that for adjacent labels, this method does not guarantee disjoint masks in the native functional space.
Copy the labels from the rois/
directory into the fsaverage
directory. NOTE: this may require sudo
, or copying (not symlinking) fsaverage into your SUBJECTS_DIR.
!cp -p rois/*.{label,annot} $SUBJECTS_DIR/fsaverage/label/
Process the main PFC ROIs from the Yeo atlas.
%%bash
rois="ifs amfg pmfg fpc ifg ains psfs"
for roi in $rois
do
make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native
done
Next the two "posterior" regions we consider for the network analyses.
%%bash
rois="ips otc"
for roi in $rois
do
make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native
done
Now the other/control ROIs in the PFC. First lateralized versions of the IFS ROI.
%%bash
for hemi in lh rh
do
make_masks.py -s subjects.txt -roi $hemi.yeo17_ifs -label yeo17_ifs -sample graymid -hemi $hemi
done
Next the anterior/posterior divisions of the IFS. These were created with the Freesurfer program mris_divide_parcellation
, which evenly splits the label along a boundary perpindicular to the princple eigenaxis.
%%bash
for roi in aifs pifs
do
make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native
done
Merge all of the PFC labels into one macro-ROI.
%%bash
for hemi in lh rh
do
mri_mergelabels -i rois/$hemi.yeo17_ifs.label -i rois/$hemi.yeo17_amfg.label -i rois/$hemi.yeo17_pmfg.label \
-i rois/$hemi.yeo17_fpc.label -i rois/$hemi.yeo17_ifg.label -i rois/$hemi.yeo17_psfs.label \
-i rois/$hemi.yeo17_ains.label -o rois/$hemi.dksort_all_pfc.label
cp rois/$hemi.dksort_all_pfc.label $SUBJECTS_DIR/fsaverage/label/
done
Generate a mask from the macro ROI.
%%bash
make_masks.py -s subjects.txt -roi dksort_all_pfc -label dksort_all_pfc -sample graymid -save_native