#!/bin/tcsh -f if ("$1" == '' || "$1" == '-h' || "$1" == '-help') then goto USAGE endif #save path set pt = $1:h if ("$pt" == "$1") then set pt = "." endif set pref = `@GetAfniPrefix $1` set view = `@GetAfniView $1` set ext = $1:e if ("$ext" == "gz" || "$ext" == "bz2" || "$ext" == "Z" ) then set Name2 = $1:r set ext = $Name2:e endif if ("$ext" == "nii") then if ( -f $1 ) then set cnt = 3 else set cnt = 0 endif goto RESULT endif if ("$view" == "" && "$ext" != "nii") then echo "Error: No view specified in dset name $1" echo "Make sure you are not passing a prefix instead" echo "of a dataset name" goto ENDALL endif set dsethead = "${pt}/${pref}${view}.HEAD" set dsetbrik = "${pt}/${pref}${view}.BRIK" set cnt = 0 if ( -f $dsethead ) then @ cnt ++ else goto RESULT endif if ( -f $dsetbrik || -f {$dsetbrik}.gz || -f {$dsetbrik}.bz2 || -f {$dsetbrik}.Z ) then @ cnt ++ else goto RESULT endif RESULT: echo $cnt goto ENDALL USAGE: echo "Usage: `basename $0` ....." echo "example: `basename $0` /Data/stuff/Hello+orig.HEAD" echo "returns 0 if neither .HEAD nor .BRIK(.gz)(.bz2)(.Z) exist" echo " 1 if only .HEAD exists" echo " 2 if both .HEAD and .BRIK(.gz)(.bz2)(.Z) exist" echo " 3 if .nii dataset " echo "Ziad Saad (ziad@nih.gov)" echo " SSCC/NIMH/ National Institutes of Health, Bethesda Maryland" echo "" goto ENDALL ENDALL: