#!/bin/tcsh -f INIT_VARS: set surf1 = lh.pial.tlrc.ply set sph1 = lh.sphere.asc set surf2 = lh.smoothwm.tlrc.ply set spec = N27_lh_tlrc.spec set ld = 35 set order = 15 set s = 0.001 PARSE: if ("$1" == "-h" || "$1" == "-help") then goto HELP endif echo "" echo "Hit enter to start suma in 'listening mode' and begin recording." echo "Only one instance of suma should be running for this to work." echo "" set jnk = $< suma -niml & sleep 3 echo "************* Hit Enter When SUMA is Running ***********" set jnk = $< #start recorder DriveSuma -com viewer_cont -key 'R' DOMAIN: echo "" echo "Creating a standard-mesh version of all surfaces involved" echo "All surfaces used in a SPHARM analysis should be isotopic" echo "and all datasets must be defined on the same domain (mesh)." echo "Typically, creating standard meshes should be done after" echo "surface-based registration (-morph sphere.reg), but for this " echo "example it does not matter." echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< #Change the density of the mesh #(this is not necessary when all surfaces involved are isotopic) set echo MapIcosahedron -spec $spec -ld $ld -morph sphere -prefix ld${ld}.lh CreateIcosahedron -rad 1.0 -ld $ld -prefix ld${ld}.unitsph unset echo set surf1 = ld${ld}.lh_std.pial.ply set surf2 = ld${ld}.lh_std.smoothwm.ply set sph1 = ld35.unitsph_surf.asc set spec = ld35.lh_std.spec DATA: #create some toy data echo "" echo "Creating sample data." echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SurfMeasures -spec ${spec} -surf_A smoothwm -surf_B pial \ -func thick -out_1D ld${ld}.lh_std.thick.1D.dset unset echo DECO: echo "" echo "Decompose the coordinates of two surfaces and write out the" echo "reconstructed surfaces and the coefficients" echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SpharmDeco -i $sph1 -unit_sph ${sph1} \ -i ${surf1} -i ${surf2} \ -l ${order} \ -bases_prefix ld${ld}.harmo \ -o_fs {$surf1:r}_reco${order} \ -prefix {$surf1:r}_reco${order} \ -sigma $s -overwrite \ -talk_suma unset echo echo "" echo "Redo the reconstruction of one surface but reuse bases computed " echo "above" echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SpharmDeco -i ${surf1} -l ${order} \ -bases_prefix ld${ld}.harmo \ -o_fs {$surf1:r}_recob${order} \ -sigma $s -overwrite \ -talk_suma unset echo echo "" echo "Decompose data defined over the surface's nodes" echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SpharmDeco -i ${surf1} -l ${order} \ -bases_prefix ld${ld}.harmo \ -data ld${ld}.lh_std.thick.1D.dset'[1]' \ -prefix ld${ld}.lh_std.thick_reco${order} \ -sigma $s -overwrite \ -talk_suma unset echo RECO: set order2 = `ccalc -i $order - 5` if ($order2 < 2) then set order2 = $order endif echo "" echo "Given spherical harmonics and corresponding coefficients," echo "reconstruct surfaces at order $order2" echo "Note that two surfaces will be written to disk and the coordinates of these" echo "reconstructed surfaces are also in {$surf1:r}_RECO${order2}.1D.dset" echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SpharmReco \ -i ${surf1} \ -l $order2 \ -bases_prefix ld${ld}.harmo \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col000.1D \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col001.1D \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col002.1D \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col003.1D \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col004.1D \ -coef ld${ld}.lh_std.pial_reco{$order}.beta.col005.1D \ -o_ply {$surf1:r}_RECO${order2} -overwrite \ -prefix {$surf1:r}_RECO${order2} -talk_suma unset echo echo "" echo "Now reconstuct data only, not XYZ of surfaces" echo "" echo "************* Hit Enter to Proceed ******************" set jnk = $< set echo SpharmReco \ -i ${surf1} \ -l $order2 \ -bases_prefix ld${ld}.harmo \ -coef ld${ld}.lh_std.thick_reco${order}.beta.col000.1D \ -prefix {$surf1:r}.thick_RECO${order2} -overwrite \ -talk_suma unset echo goto END HELP: echo "" echo "Usage: `basename $0`" echo "A script to demonstrate the usage of spherical harmonics decomposition " echo "with SUMA" echo "" echo "To run it you will need some of SUMA's N27 tlrc surfaces, which can be " echo "downloaded from: http://afni.nimh.nih.gov/pub/dist/tgz/suma_tlrc.tgz" echo "The surfaces needed are $surf1, $surf2, $sph1, and $spec" echo "" echo "To change the parameter settings, make a copy of this script" echo "and modify the section at the top called 'INIT_VARS'" echo "If you do not make a copy of this script, future AFNI updates will" echo "overwrite your changes." echo "" echo " Ziad S. Saad SSCC/NIMH/NIH" echo "" END: