#!/bin/tcsh # ## ---------------------------------------------------------------------- ## Convert a drawn surface ROI to the volume (and back?). ## ## In suma, draw an ROI and save it as (prefix) tuna.lh , ## then run this script. ## ## This script runs ROI2dataset to convert the tuna ROI into a ## surface dataset (NIML), and then runs 3dSurf2Vol to project ## that into the volume domain, filling the volxels between the ## smooth WM and pial surfaces. ## ## Afterwards, one could view the volume ROI in afni, 'talk' to ## suma, and see how the volume ROI maps back to the surface. ## ---------------------------------------------------------------------- # ------------------------------ # note input dataset name if ( $#argv > 0 ) then set prefix = $argv[1] else set prefix = tuna endif # ------------------------------ # be sure input exists if ( ! -f $prefix.lh.niml.roi ) then echo "** missing input dataset: $prefix.lh.niml.roi" echo " please 'draw' in suma to create it (save -> $prefix.lh)" echo "" exit 1 endif # ------------------------------ # 1. convert to proper surface dataset (not ROI), # with only one value per node # 2. map to volume ROI2dataset -prefix $prefix.lh.niml.dset -input $prefix.lh.niml.roi # consider also @surf_to_vol_spackle 3dSurf2Vol \ -spec std.141.FT_lh.spec \ -surf_A smoothwm \ -surf_B pial \ -sv FT_SurfVol.nii \ -grid_parent FT_SurfVol.nii \ -map_func mode \ -f_steps 12 \ -sdata $prefix.lh.niml.dset \ -prefix $prefix.lh.s2v.roi if ( $status ) then echo "** failed 3dSurf2Vol" echo 1 endif echo "" echo "++ created $prefix.lh.s2v.roi" echo ""