1#!/bin/tcsh -fe 2 3set stat = 0 4set sdir = $PWD 5 6# [PT: May 1, 2020] updated version 7# [PT: July 30, 2020] updated version, run @Install_NMT here, too 8# [PT: Aug 4, 2020] simplify directory numbering 9# [PT: Oct 23, 2021] @Install_NMT gets v2.1 10set demo = MACAQUE_DEMO 11 12goto PARSE 13RET_PARSE: 14 15if ( -d ./$demo) then 16echo "" 17echo "ERROR:" 18echo " Directory ./$demo exists already" 19echo " If you want to recreate it, remove it with:" 20echo "\rm -rf ./$demo" 21echo " then run `basename $0` $argv[*] again." 22echo "" 23echo "Otherwise to run demos, see content of ./$demo/README.txt" 24echo "" 25goto END 26 endif 27 28echo "++ Going to fetch demo: ${demo}" 29 30if ($use_curl == -1) then 31 which curl 32 if ($status) then 33 set use_curl = 0; 34 else 35 set use_curl = 1; 36 endif 37endif 38 39if ($use_curl == 0) then 40 wget https://afni.nimh.nih.gov/pub/dist/tgz/$demo.tgz 41else 42 curl -O https://afni.nimh.nih.gov/pub/dist/tgz/$demo.tgz 43endif 44tar xvzf $demo.tgz 45cd $demo 46 47echo "++ Getting standard reference datasets:" 48echo " symmetric NMT v2.1, CHARM, D99 atlas, and more." 49 50if ($use_curl == 0) then 51 @Install_NMT -wget -sym sym -nmt_ver 2.1 52else 53 @Install_NMT -curl -sym sym -nmt_ver 2.1 54endif 55 56echo "********************************************************" 57echo "Follow examples in ./${demo}/README.txt " 58echo "********************************************************" 59 60tcsh check_for_template.tcsh 61 62cd - 63 64goto END 65 66PARSE: 67 set Narg = $# 68 set use_curl = -1 69 set cnt = 1 70 while ($cnt <= $Narg) 71 set donext = 1; 72 if ($donext && "$argv[$cnt]" == "-echo") then 73 set echo 74 set donext = 0; goto NEXT 75 endif 76 if ($donext && "$argv[$cnt]" == "-curl") then 77 set use_curl = 1 78 set donext = 0; goto NEXT 79 endif 80 if ($donext && "$argv[$cnt]" == "-wget") then 81 set use_curl = 0 82 set donext = 0; goto NEXT 83 endif 84 if ($donext && ("$argv[$cnt]" == "-h" || "$argv[$cnt]" == "-help")) then 85 goto HELP 86 set donext = 0; goto NEXT 87 endif 88 if ($donext == 1) then 89 echo "Error: Option or parameter '$argv[$cnt]' not understood" 90 goto END 91 endif 92 93 NEXT: 94 @ cnt ++ 95 end 96 97goto RET_PARSE 98 99HELP: 100 echo "Installs the demo archive for AFNI's macaque-analysis demo." 101 echo "After the archive is downloaded and unpacked, see its README.txt" 102 echo "for details." 103 echo "Options:" 104 echo "[-wget]: Use wget to download archive. Script chooses by default" 105 echo " with preference for curl" 106 echo "[-curl]: Use curl to download archive. Script chooses by default" 107 echo " with preference for curl" 108 goto END 109 110BEND: 111 echo "Failed" 112 set stat = 1 113 goto END 114 115END: 116 exit $stat 117