Skip to content
Snippets Groups Projects
eddy_correct 763 B
Newer Older
David Flitney's avatar
David Flitney committed
#!/bin/sh

#   Copyright (C) 2004 University of Oxford
#
#   SHCOPYRIGHT

Usage() {
    echo ""
    echo "Usage: eddy_correct <4dinput> <4doutput> <reference_no>"
    echo ""
Duncan Mortimer's avatar
Duncan Mortimer committed
    exit 1
David Flitney's avatar
David Flitney committed
}

[ "$3" = "" ] && Usage

input=`${FSLDIR}/bin/remove_ext ${1}`
output=`${FSLDIR}/bin/remove_ext ${2}`
ref=${3}

if [ `${FSLDIR}/bin/imtest $input` -eq 0 ];then
    echo "Input does not exist or is not in a supported format"
Duncan Mortimer's avatar
Duncan Mortimer committed
    exit 1
David Flitney's avatar
David Flitney committed
fi

avwroi $input $output $ref 1

avwsplit $input
full_list=`${FSLDIR}/bin/imglob -oneperimage vol*`

for i in $full_list ; do
    echo processing $i
    echo processing $i >> ${output}.ecclog
    ${FSLDIR}/bin/flirt -in $i -ref $output -nosearch -o $i -paddingsize 1 >> ${output}.ecclog
done

avwmerge -t $output $full_list

/bin/rm vol*