#!/bin/tcsh -f
set noglob

if ("$1" == '' || "$1" == '-h' || "$1" == '-help') then
	goto USAGE
endif

#remove path
set Name = $1:t
#remove extension .HEAD or .BRIK
set Name = $Name:r


#remove +orig or whatever it is
echo $Name | grep -q '+orig'
if ($status == 0) then 
	echo '+orig'
	goto ENDALL
endif
echo $Name | grep -q '+acpc'
if ($status == 0) then 
	echo '+acpc'
	goto ENDALL
endif
echo $Name | grep -q '+tlrc'
if ($status == 0) then 
	echo '+tlrc'
	goto ENDALL
endif



goto ENDALL

USAGE:
	echo "Usage: `basename $0` <Name> ....."
	echo "example: `basename $0` /Data/stuff/Hello+orig.HEAD"
	echo "returns the afni view of Name (+orig)" 
	echo "Wildcards are treated as regular characters:"
	echo "example: `basename $0` 'AAzst1r*+orig'"
	echo "returns : +orig"
	echo "\012Ziad Saad (ziad@nih.gov)\012LBC/NIMH/ National Institutes of Health, Bethesda Maryland\012"
	goto ENDALL

ENDALL:
unset noglob
