#!/bin/tcsh -f

#Need three arguments: S1, S2, Sout
#Example: @SurfMean lh.pial.asc lh.smoothwm.asc lh.midlayer
ConvertSurface -i $1 -o_1D ___tmp_$1:r ___tmp_$1:r
ConvertSurface -i $2 -o_1D ___tmp_$2:r ___tmp_$2:r
3dMean -prefix ___tmp_mean ___tmp_$1:r'.1D.coord' ___tmp_$2:r'.1D.coord'
ConvertSurface -i_1D ___tmp_mean.1D ___tmp_$1:r'.1D.topo' -o_fs $3 
rm -f ___tmp_*
