# Script created October 2007 by Kayle Sawyer for use at the MGH Martinos Center.
# Use with Freesurfer 3.x

# This script will take a list of ROIs created for one subject, copy it to many subjects, 
# create thresholded ROIs from functional activation, and output text summaries.

# First, use tksurfer to save ROIs in one subject's directory that mri_label2label will copy to the rest.
# That is listed here as SUBJECT_WITH_MANUALLY_CREATED_ROI, so replace that text with whatever subject you used.
# Edit the mri_label2label --srcsubject to refer to that subject.
# & after lines designed for quad-core.
# All_FE, All_FR, etc are separate tasks subjects did in the scan.
# You'll have to change the roi_summary subject list manually, sorry.

cd #your directory where functional scans are stored.

set subject =  'YOUR SUBJECT LIST'
set hemisphere = 'rh lh'
set roilist = 'YOUR ROIS'

foreach hemi ($hemisphere) 
        foreach s ($subject)
                foreach roi ($roilist)
                mri_label2label --srcsubject SUBJECT_WITH_MANUALLY_CREATED_ROI --srclabel $SUBJECTS_DIR/SUBJECT_WITH_MANUALLY_CREATED_ROI/label/${roi}.label --trgsubject ${s} --trglabel $SUBJECTS_DIR/${s}/label/${roi}_${hemi}.label --regmethod surface --hemi ${hemi}
                func2roi-sess -roidef ${roi}_${hemi}_All_FE -analysis All_FE -d . -s ${s}_sess -labelfile $SUBJECTS_DIR/${s}/label/${roi}_${hemi}.label -maskthresh 2 &
                func2roi-sess -roidef ${roi}_${hemi}_All_FR -analysis All_FR -d . -s ${s}_sess -labelfile $SUBJECTS_DIR/${s}/label/${roi}_${hemi}.label -maskthresh 2 &
                func2roi-sess -roidef ${roi}_${hemi}_All_WE -analysis All_WE -d . -s ${s}_sess -labelfile $SUBJECTS_DIR/${s}/label/${roi}_${hemi}.label -maskthresh 2 &
                func2roi-sess -roidef ${roi}_${hemi}_All_WR -analysis All_WR -d . -s ${s}_sess -labelfile $SUBJECTS_DIR/${s}/label/${roi}_${hemi}.label -maskthresh 2
                end
        end
end
foreach hemi ($hemisphere) 
        foreach roi ($roilist)
                roisummary-sess -d . -s NC2_sess -s NC3_sess -s NC4_sess -s NC10_sess -s NC12_sess -s NC13_sess -s NC16_sess -s NC19_sess -s NC20_sess -s NC21_sess -s NC22_sess -s NC23_sess -s NC24_sess -s NC25_sess -s NC26_sess -s NC1_sess -s NC5_sess -s NC6_sess -s NC7_sess -s NC8_sess -s NC9_sess -s NC11_sess -s NC14_sess -s NC15_sess -s NC18_sess -s NC30_sess -s NC31_sess -s NC33_sess -s NC34_sess -s NC35_sess -analysis All_FE -roidef ${roi}_${hemi}_All_FE -sumfile $SUBJECTS_DIR/ROI/${roi}_${hemi}_All_FE.txt -transpose
                roisummary-sess -d . -s NC2_sess -s NC3_sess -s NC4_sess -s NC10_sess -s NC12_sess -s NC13_sess -s NC16_sess -s NC19_sess -s NC20_sess -s NC21_sess -s NC22_sess -s NC23_sess -s NC24_sess -s NC25_sess -s NC26_sess -s NC1_sess -s NC5_sess -s NC6_sess -s NC7_sess -s NC8_sess -s NC9_sess -s NC11_sess -s NC14_sess -s NC15_sess -s NC18_sess -s NC30_sess -s NC31_sess -s NC33_sess -s NC34_sess -s NC35_sess -analysis All_FR -roidef ${roi}_${hemi}_All_FR -sumfile $SUBJECTS_DIR/ROI/${roi}_${hemi}_All_FR.txt -transpose
                roisummary-sess -d . -s NC2_sess -s NC3_sess -s NC4_sess -s NC10_sess -s NC12_sess -s NC13_sess -s NC16_sess -s NC19_sess -s NC20_sess -s NC21_sess -s NC22_sess -s NC23_sess -s NC24_sess -s NC25_sess -s NC26_sess -s NC1_sess -s NC5_sess -s NC6_sess -s NC7_sess -s NC8_sess -s NC9_sess -s NC11_sess -s NC14_sess -s NC15_sess -s NC18_sess -s NC30_sess -s NC31_sess -s NC33_sess -s NC34_sess -s NC35_sess -analysis All_WE -roidef ${roi}_${hemi}_All_WE -sumfile $SUBJECTS_DIR/ROI/${roi}_${hemi}_All_WE.txt -transpose
                roisummary-sess -d . -s NC2_sess -s NC3_sess -s NC4_sess -s NC10_sess -s NC12_sess -s NC13_sess -s NC16_sess -s NC19_sess -s NC20_sess -s NC21_sess -s NC22_sess -s NC23_sess -s NC24_sess -s NC25_sess -s NC26_sess -s NC1_sess -s NC5_sess -s NC6_sess -s NC7_sess -s NC8_sess -s NC9_sess -s NC11_sess -s NC14_sess -s NC15_sess -s NC18_sess -s NC30_sess -s NC31_sess -s NC33_sess -s NC34_sess -s NC35_sess -analysis All_WR -roidef ${roi}_${hemi}_All_WR -sumfile $SUBJECTS_DIR/ROI/${roi}_${hemi}_All_WR.txt -transpose
        end
end

UserContributions/Scripts/kslays/roi (last edited 2008-04-29 11:45:46 by localhost)