#!/bin/tcsh # ---------------------------------------------------------------------- # Run 3dSetupGroupInCorr for the motion groups, big and small # SUBJ #TRs #censor ave_mot ave_censor ave_TSNR # # assumes under misc_dir: group.big.txt, group.small.txt # assumes instacorr directory # # for each group # make a list of subjects # make corresponding subject label file # make corresponding list of errts datasets # ---------------------------------------------------------------------- # set up and basic tests set top_dir = `pwd` set misc_dir = $top_dir/misc_dir set res_dir = $top_dir/subject_results set icor_dir = $top_dir/instacorr set gind = 1 # index of grouping (big, quartiles, random, etc.) # check that we have results scripts/check.subj.results if ( $status ) exit # check for any needed input files set needed_files = ( $misc_dir/group.$gind.{big,small}.txt $icor_dir $res_dir ) foreach file ( $needed_files ) if ( ! -e $file ) then echo "** setup GIC motion: missing input file/dir, $file" exit endif end # ---------------------------------------------------------------------- # additions to script... set res = 3 # assume 3 mm resolution set group_list = ( big small ) # enter instacorr dir and get to work cd $icor_dir # if this has already been done, skip it if ( -f ic.$gind.small.errts.grpincorr.niml ) then echo "-- setup GIC : already have ic.$gind.small.errts.grpincorr.niml" echo " ready to run 3dGroupInCorr from:" echo " $icor_dir" exit endif foreach gname ( $group_list ) set subjects = ( `cat $misc_dir/group.$gind.$gname.txt` ) echo "-- have $#subjects in group $gname" # from list of subjects, create label file and dset list set lab_file = labels.$gind.$gname.txt echo -n "" > $lab_file set dsets = () foreach subj ( $subjects ) echo $subj >> $lab_file set dsets = ( $dsets $res_dir/$subj/$subj.results/errts.$subj+tlrc.HEAD ) end # note dataset prefix (delete if exists) set ic_prefix = ic.$gind.$gname.errts set ic_result = $ic_prefix.grpincorr.niml if ( -f $ic_result ) \rm -f $ic_prefix.grpincorr.* set mask = aref_mask_${res}mm+tlrc set cmd = ( 3dSetupGroupInCorr -labels $lab_file -prefix $ic_prefix \ -mask $mask $dsets ) echo $cmd $cmd if ( $status ) exit 1 end echo "" echo "== ready to run 3dGroupInCorr from:" echo " $icor_dir" echo ""