diff --git a/Makefile b/Makefile index 1ba6537a2e5ad4bb3cf3467cdb3af129f1486754..0f67ade8957f29052660932e428efc2da57cbfe2 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ FTBOBJS=find_the_biggest.o PJOBJS=proj_thresh.o MEDOBJS=medianfilter.o - +SCRIPTS = eddy_correct XFILES = dtifit probtrack find_the_biggest medianfilter RUNTCLS = Fdt diff --git a/eddy_correct b/eddy_correct new file mode 100644 index 0000000000000000000000000000000000000000..6159a3b5648816d7db6b3aa0c570031e45ef284f --- /dev/null +++ b/eddy_correct @@ -0,0 +1,43 @@ +#!/bin/sh + +Usage() { +echo "" +echo "Usage: eddy_coorect <4dinput> <4doutput> <reference_no>" +echo "" +exit +} + +[ "$1" = "" ] && Usage +[ "$2" = "" ] && Usage +[ "$3" = "" ] && Usage + +input=`basename ${1} .hdr` +input=`basename ${input} .img` +output=`basename ${2} .hdr` +output=`basename ${output} .img` +ref=${3} + +if [ ! -e ${input}.hdr -o ! -e ${input}.img ];then + echo "Input does not exist or is not in analyze format" + exit +fi + +avwroi ${input} ${$}ref ${ref} 1 + +nvols=`avwval ${input} dim4` +avwsplit ${input} +i=0; +avwmaths vol0000 newvol0000 +while [ ${i} -lt ${nvols} ];do + echo ${i} volumes completed + inp=`zeropad $i 4`; + flirt -in vol${inp} -ref ${$}ref -nosearch -o newvol${inp} + i=`expr $i + 1`; +done +rm vol* ${$}* +avwmerge -t ${output} newvol*.hdr + +rm newvol* + + +