Newer
Older
# preprocessing for DTI images acquired at FMRIB
Usage() {
echo "REMOVE_VOLS - Remove dodgy volumes from DTI data acquired at FMRIB "
echo ""
echo "USAGE: remove_vols <input_file> <output_file> <dodgyvols> "
echo ""
echo "example: remove_vols data data_rv 4 19 35"
echo ""
echo "Note that the first volume is 0 and not 1"
echo ""
}
[ "$1" = "" ] && Usage
[ "$2" = "" ] && Usage
[ "$3" = "" ] && Usage
input_file=$1
output_file=$2
current_dir=`pwd`
if [ ! `imtest $input_file` ]; then
echo Cant find $input_file
exit
fi
if [ ! -e bvals ]; then
echo Cant find bvals
exit
fi
if [ ! -e bvecs ]; then
echo Cant find bvecs
exit
fi
vol=0
num_vols=`expr $# - 2`
t=""
rm dodgy_vols -f
if [ `imtest vol000${v}` ]; then
imrm vol000${v}
if [ `imtest vol00${v}` ]; then
imrm vol00${v}
fi
echo $v > tmp1
cat dodgy_vols tmp1 > tmp2
cat tmp2 > dodgy_vols
echo Removing dodgy volumes from bvals and bvecs
matlab -nodisplay -nojvm -nosplash 1> matlab.out1 2>&1 <<EOF
addpath('/usr/people/dtiuser/etc/FMRIB_bvals_bvecs/');
remove_vols('$current_dir');
exit
EOF