{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "ROI mask generation for DKsort project" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook contains the scripts for generating masks defining ROIs used for decoding analyses in the DKsort experiment.\n", "\n", "It actaully consistes of a number of bash scripts executing the [`make_masks.py`](https://github.com/mwaskom/lyman/blob/master/scripts/make_masks.py) program that is part of [lyman](http://github.com/mwaskom/lyman).\n", "\n", "The ROIs for this project were all drawn from a population atlas of task-independent networks ([Yeo et al. 2011](http://www.ncbi.nlm.nih.gov/pubmed/21653723)). 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](http://ftp.nmr.mgh.harvard.edu/fswiki/CorticalParcellation_Yeo2011).\n", "\n", "The ROIs are mapped to individual subjects using the following steps:\n", " \n", "- Warp the ROI labsls to the native surfaces using the curvature-based registration from `recon-all`\n", "\n", "- Linearly transform the coordinates to align with the functional data by inverting the `BBRegister` matrix\n", "\n", "- Project half the cortical thickness from each vertex in the ROI and label all intersected voxels in the native functional space\n", "\n", "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." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "collapsed": false, "input": [ "!cp -p rois/*.{label,annot} $SUBJECTS_DIR/fsaverage/label/" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Process the main PFC ROIs from the Yeo atlas." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "rois=\"ifs amfg pmfg fpc ifg ains psfs\"\n", "for roi in $rois\n", " do\n", " make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native\n", " done" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next the two \"posterior\" regions we consider for the network analyses." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "rois=\"ips otc\"\n", "for roi in $rois\n", " do\n", " make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native\n", " done" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now the other/control ROIs in the PFC. First lateralized versions of the IFS ROI." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "for hemi in lh rh\n", " do\n", " make_masks.py -s subjects.txt -roi $hemi.yeo17_ifs -label yeo17_ifs -sample graymid -hemi $hemi\n", " done" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "for roi in aifs pifs\n", " do\n", " make_masks.py -s subjects.txt -roi yeo17_$roi -label yeo17_$roi -sample graymid -save_native\n", " done" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Merge all of the PFC labels into one macro-ROI." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "for hemi in lh rh\n", " do\n", " mri_mergelabels -i rois/$hemi.yeo17_ifs.label -i rois/$hemi.yeo17_amfg.label -i rois/$hemi.yeo17_pmfg.label \\\n", " -i rois/$hemi.yeo17_fpc.label -i rois/$hemi.yeo17_ifg.label -i rois/$hemi.yeo17_psfs.label \\\n", " -i rois/$hemi.yeo17_ains.label -o rois/$hemi.dksort_all_pfc.label\n", " cp rois/$hemi.dksort_all_pfc.label $SUBJECTS_DIR/fsaverage/label/\n", " done" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Generate a mask from the macro ROI." ] }, { "cell_type": "code", "collapsed": false, "input": [ "%%bash\n", "make_masks.py -s subjects.txt -roi dksort_all_pfc -label dksort_all_pfc -sample graymid -save_native" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }