#! /bin/tcsh -f # # roixrunsum-sess - cross-run summary of an ROI # # Original Author: Doug Greve # CVS Revision Info: # $Author: nicks $ # $Date: 2007/01/09 22:41:18 $ # $Revision: 1.2 $ # # Copyright (C) 2002-2007, # The General Hospital Corporation (Boston, MA). # All rights reserved. # # Distribution, usage and copying of this software is covered under the # terms found in the License Agreement file named 'COPYING' found in the # FreeSurfer source code root directory, and duplicated here: # https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferOpenSourceLicense # # General inquiries: freesurfer@nmr.mgh.harvard.edu # Bug reports: analysis-bugs@nmr.mgh.harvard.edu # set VERSION = '$Id: roixrunsum-sess,v 1.2 2007/01/09 22:41:18 nicks Exp $'; set inputargs = ($argv); set DateStr = "`date '+%y%m%d%H%M'`" set roidef = (); set analysis = (); set type = (); set synth = (); set monly = 0; set PrintHelp = 0; if($#argv == 0) goto usage_exit; set n = `echo $argv | grep -e -help | wc -l` if($n != 0) then set PrintHelp = 1; goto usage_exit; endif set n = `echo $argv | grep -e -version | wc -l` if($n != 0) then echo $VERSION exit 0; endif set PWD = `getpwdcmd`; if($status) exit 1; set SessList = `getsesspath $argv`; if($status || $#SessList == 0) then getsesspath $argv exit 1; endif goto parse_args; parse_args_return: goto check_params; check_params_return: ##### Create a log file ###### set logdir = `pwd`/log; mkdir -p $logdir if(! -e $logdir) then echo "WARNING: could not create $logdir" set LF = /dev/null else set LF = $logdir/roixrunsum-sess-$DateStr.log if(-e $LF) mv $LF $LF.old endif echo "--------------------------------------------------------------" echo "roixrunsum-sess logfile is $LF" echo "--------------------------------------------------------------" echo "roixrunsum-sess log file" >> $LF echo $VERSION >> $LF id >> $LF pwd >> $LF echo $0 >> $LF echo $inputargs >> $LF uname -a >> $LF date >> $LF # get full path for cfg and info files # pushd $analysis > /dev/null; set analysisdir = `pwd`; popd > /dev/null; set infofile = $analysisdir/analysis.info if(! -e $infofile) then echo "ERROR: cannot find $infofile" exit 1; endif ## Get parameters from the info file ## set fsd = `cat $infofile | awk '{if($1 == "fsd") print $2}'`; set runlistfile = `cat $infofile | awk '{if($1 == "runlistfile") print $2}'`; ### Go through each session ### set StartTime = `date`; foreach sess ($SessList) set sessbase = `basename $sess`; echo "-------------------------------------------" |& tee -a $LF echo "$sess " |& tee -a $LF date |& tee -a $LF if(! -e $analysis) then echo "ERROR: $analysis does not exist" exit 1 endif cd $sess/$fsd if($#runlistfile == 0) then set RunList = `getrunlist .`; if($status || $#RunList == 0) then echo "ERROR: $sess/$fsd has no runs" |& tee -a $LF exit 1; endif else if(! -e $runlistfile) then echo "ERROR: ($sessbase) could not find runlistfile $runlistfile" exit 1; endif set RunList = (`cat $runlistfile`); endif foreach run ($RunList) if($type == jackknife) then set a = $analysis-jk$run; else set a = $analysis-$run; endif if(! -e $a/$roidef) then echo "ERROR: cannot find $a/$roidef" exit 1; endif end set outdir = $analysis/$roidef mkdir -p $outdir set outfile = $outdir/h-$typecode-xrun_000.bfloat #set MLF = /tmp/roixrunsum_$$.m set MLF = roixrunsum.m rm -f $MLF #--------------------------------------------------------# tee $MLF <