#!/usr/bin/ksh
#
# usage:
#	wfu_FULLPROCESS dicom_directory or tar.gz file
#
# run the full processing stream on a dicom_directory or tar.gz
#
# the dicom directory is expected to be off the study direcotry.
#
# the tar.gz is a file of dicoms and expected to be IN the study directory
#

. ${WFU_PATH}/global.site.ksh

if (test $# -lt 1) then
	echo usage:
	echo wfu_FULLPROCESS dicom_directory or tar.gz file
	exit
fi

if [[ -d $1 ]]; then
	echo "processing dicom directory: $1"
	mkdir $1/../log 2>/dev/null
	${WFU_PIPELINE}/fmri/autolocsort_excite_paradigm $1 1
	exit
fi

if [[ -f $1 ]]; then
	echo "processing dicom tar.gz: $1"
	studyDir=`dirname $1`
	mkdir $studyDir/log 2>/dev/null
	${WFU_PIPELINE}/fmri/autolocsort_excite_paradigm $1
	exit
fi

echo "ERROR: This script does not know how to handle $1."
echo "Please see the documentation."


