#!/bin/sh Usage() { echo " Usage: to-two-tailed [vmc]" echo " is the out_root given to randomise" echo " e.g. if name is 'test_a' we combine single-tailed" echo " test_a_vox_tstat1 and test_a_vox_tstat2 into" echo " two-tailed test_a_vox_tstat (and/or the same for max, maxc)" echo "" echo " vmc is an optional flag selecting which correction:" echo " v = vox (uncorrected); m = max; c = cluster;" echo " C = cluster-mass; a = all (default)." exit 1 } Setup() { echo "Can't find avwmaths; please set-up FSL" exit 1 } [ "$1" = "" ] && Usage [ -x $FSLDIR/bin/avwmaths ] || Setup imglob="imglob -oneperimage" fnm=$1 vmc=$2 [ "$vmc" = "v" ] && VM="vox" [ "$vmc" = "m" ] && VM="max" [ "$vmc" = "c" ] && VM="maxc" [ "$vmc" = "C" ] && VM="maxcmass" # default to all if unspecified [[ "$vmc" = "a" || "$vmc" = "" ]] && VM="vox max maxc maxcmass" # print usage if mis-specified [ "$VM" = "" ] && Usage for vm in $VM do t1=${fnm}_${vm}_tstat1 t2=${fnm}_${vm}_tstat2 t1g=`$imglob $t1` t2g=`$imglob $t2` if [[ -r $t1g && -r $t2g ]] then avwmaths $t1 -max $t2 -mul 2 -sub 1 -thr 0 ${fnm}_${vm}_tstat else echo " WARNING: one of $t1 or $t2 unreadable, skipping" fi done