run.roi2dset 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/tcsh
  2. #
  3. ## ----------------------------------------------------------------------
  4. ## Convert a drawn surface ROI to the volume (and back?).
  5. ##
  6. ## In suma, draw an ROI and save it as (prefix) tuna.lh ,
  7. ## then run this script.
  8. ##
  9. ## This script runs ROI2dataset to convert the tuna ROI into a
  10. ## surface dataset (NIML), and then runs 3dSurf2Vol to project
  11. ## that into the volume domain, filling the volxels between the
  12. ## smooth WM and pial surfaces.
  13. ##
  14. ## Afterwards, one could view the volume ROI in afni, 'talk' to
  15. ## suma, and see how the volume ROI maps back to the surface.
  16. ## ----------------------------------------------------------------------
  17. # ------------------------------
  18. # note input dataset name
  19. if ( $#argv > 0 ) then
  20. set prefix = $argv[1]
  21. else
  22. set prefix = tuna
  23. endif
  24. # ------------------------------
  25. # be sure input exists
  26. if ( ! -f $prefix.lh.niml.roi ) then
  27. echo "** missing input dataset: $prefix.lh.niml.roi"
  28. echo " please 'draw' in suma to create it (save -> $prefix.lh)"
  29. echo ""
  30. exit 1
  31. endif
  32. # ------------------------------
  33. # 1. convert to proper surface dataset (not ROI),
  34. # with only one value per node
  35. # 2. map to volume
  36. ROI2dataset -prefix $prefix.lh.niml.dset -input $prefix.lh.niml.roi
  37. # consider also @surf_to_vol_spackle
  38. 3dSurf2Vol \
  39. -spec std.141.FT_lh.spec \
  40. -surf_A smoothwm \
  41. -surf_B pial \
  42. -sv FT_SurfVol.nii \
  43. -grid_parent FT_SurfVol.nii \
  44. -map_func mode \
  45. -f_steps 12 \
  46. -sdata $prefix.lh.niml.dset \
  47. -prefix $prefix.lh.s2v.roi
  48. if ( $status ) then
  49. echo "** failed 3dSurf2Vol"
  50. echo 1
  51. endif
  52. echo ""
  53. echo "++ created $prefix.lh.s2v.roi"
  54. echo ""