#! /bin/csh -f # # avgraw # # average raw fMRI on a time-point by time-point basis # # Original Author: Doug Greve # CVS Revision Info: # $Author: nicks $ # $Date: 2007/01/09 22:41:16 $ # $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: avgraw,v 1.2 2007/01/09 22:41:16 nicks Exp $' set n = `echo $argv | grep version | wc -l` if($n != 0) then echo $VERSION exit 0; endif set instems = (); set outstem = (); set stdstem = (); set zstem = (); set firstslice = (); set nslices = (); set BFileOutExt = bfloat; set BFileInExt = (); set monly = 0; set SynthData = 0; set SynthSeed = -1; if ( $#argv == 0 ) then echo "USAGE: avgraw [-options] -i instem -i instem -o outstem"; echo " instem - prefix of input files"; echo "Options:"; echo " -std stdstem : save std dev to stdstem" echo " -z zstem : save z-score to zstem" echo " -bfloat : produce bfloat files instead of bshort" echo " -monly mfile : don't run, just generate a matlab file" echo " -version : print version and exit" echo "" echo " $VERSION" echo " Comments or questions: analysis-bugs@nmr.mgh.harvard.edu" echo "" exit 1; endif goto parse_args; parse_args_return: ## Autodetect Input extension ## if($#BFileInExt == 0) then set BFileInExt = `getbext $instems[1]`; if($status) then echo "ERROR: detecting extension of $instems[1]" exit 1; endif endif ## Autodetect First Slice ## if($#firstslice == 0) then set firstslice = `getfirstsliceno $instems[1]`; if($status) then echo "ERROR: detecting slice $firstslice of $instems[1]" exit 1; endif endif ## Autodetect Number of Slices ## if($#nslices == 0) then set nslices = `getnslices $instems[1] $firstslice`; if($status) then echo "ERROR: nslices of $instems[1]" exit 1; endif endif goto check_params; check_params_return: set MATLAB = `getmatlab`; if($status) exit 1; #### Output Directory ####### if($#outstem > 1) then set OutDir = `dirname $outstem`; set OutBase = `basename $outstem`; mkdir -p $OutDir; endif if ($monly) then set QuitOnError = 0; set TARGET = "tee $mfile" rm -f $mfile; else set QuitOnError = 1; set TARGET = "$MATLAB -display iconic" endif #---------------------------------------------------------------# $TARGET <