#!/bin/csh -f if ("$1" == '' || "$1" == '-help' || "$1" == '-h') then goto HELP endif PARSE: echo "Parsing ..." set Narg = $# #find the locations of -com and -list set cnt = 1 set ss = '' set sslab = '' while ($cnt <= $Narg) if ("$argv[$cnt]" == "-sub") then set SubLoc = $cnt if ($SubLoc == $Narg) then echo "Need option after -sub" goto END else @ cnt ++ set ss = "$argv[$cnt]" if ("$sslab" == "") then set sslab = 'subset_pure' endif set NxtInd = $cnt endif endif if ("$argv[$cnt]" == "-suf") then set SufLoc = $cnt if ($SufLoc == $Narg) then echo "Need option after -suf" goto END else @ cnt ++ set sslab = "$argv[$cnt]" set NxtInd = $cnt endif endif @ cnt ++ end if ("$sslab" == "") then set sslab = 'pure' endif @ NxtInd ++ set list = ( $argv[$NxtInd-$#argv] ) #echo "$ss" #echo "$sslab" #echo "$list" DOIT: foreach fl ($list) set pref = `@NoExt ${fl} 1D 1D.dset` ConvertDset -i_1D -o_1Dp -input ${fl}"$ss" -prefix ${pref}_${sslab} end goto END HELP: echo "Usage: `basename $0` [<-sub SUB_STRING>] dset1 dset2 ..." echo "Purifies a series of 1D files for faster I/O into matlab." echo " -sub SUB_STRING: You can use the sub-brick selection" echo " mode, a la AFNI, to output a select" echo " number of columns. See Example below." echo " -suf STRING: STRING is attached to the output prefix" echo " which is formed from the input names" echo "" echo "Example:" echo " @Purify_1D -sub '[0,3]' somedataset.1D.dset" echo "" echo "Ziad S. Saad SSCC/NIMH/NIH saadz@mail.nih.gov" echo "" goto END END: