Skip to content
Snippets Groups Projects
Commit 189f769d authored by Tim Behrens's avatar Tim Behrens
Browse files

*** empty log message ***

parent c21d48a3
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
usage()
{
echo "Usage : $0 <big4D dataset> <avg file>"
echo ""
echo " This script assumes that there are 3"
echo " separate averages of 0, 29, 0, 31, 0, 0, 0 b-values"
echo " You need to also run Make_bvecs in matlab"
echo " <artefactfile> is optional"
exit 1
}
[ $# -lt 2 ] && usage
data=`remove_ext ${1}`;
if [ `imtest $data` -eq 0 ];then
echo "Cannot find image called $1";
exit
fi
avgfile=$2;
if [ ! -e $avgfile ];then
echo " Cannot find $2"
exit
fi
numlines=`cat $avgfile |grep -v '^ *$'|wc -l`;
numavgs=`expr $numlines - 1`;
scans_per_avg=`cat $avgfile |sed 's/, *$/ /g'|sed 's/[^,]/ /g'|sed -n '1p'|wc -w`;
scans_per_avg=`expr $scans_per_avg + 1`
b0_numbers=`cat $avgfile |grep -v '^ *$' |sed -n "${numlines}p"`;
ab0=`echo $b0_numbers |awk '{print \$1}'`
eddy_correct ${1} ${$}${1}_b0_correct $ab0
total_vols=`avwval $1 dim4`;
vols_per_avg=`echo "10k $total_vols $numavgs / p"|dc -`;
avwroi ${1} data 0 ${vols_per_avg};
avwmaths data -mul 0 data;
avg=1;scan=1;
while [ ${avg} -le ${numavgs} ]; do
scan=1
#echo ${scan} ${scans_per_avg}
while [ ${scan} -le ${scans_per_avg} ]; do
tmp=`cat $avgfile |sed -n "${avg}p"|awk -F , "{ print \\$$scan }"`;
echo $avg $scan $tmp $vols_per_avg
avwroi ${$}${1}_b0_correct ${$}avg_${avg}_scan_${scan} $tmp;
scan=`expr $scan + 1`;
done
avwmerge -t ${$}avg_${avg}_all `imglob -oneperimage ${$}avg_${avg}_scan_*`
add4d data ${$}avg_${avg}_all data;
avg=`expr $avg + 1`;
done
avwmaths data -div ${numavgs} data;
rm ${$}*
#!/bin/sh
usage()
{
echo "Usage :ocmr_preproc <number of slices per volume>"
echo ""
exit 1
}
[ $# -lt 1 ] && usage
nep=`echo *ep2d_* |wc -w`
nlp=`echo *lp2d_* |wc -w`
if [ $nep -gt 1 ];then
avwmerge -t big4D `imglob -oneperimage images_?_*ep2d_* images_??_*ep2d_*`
elif [ $nlp -gt 1 ];then
avwmerge -t big4D `imglob -oneperimage images_?_*lp2d_* images_??_*lp2d_*`
fi
#nslices=${1}
#zsize=`avwval big4D dim3`
#tsize=`avwval big4D dim4`
#tpts=`echo "10k $zsize $nslices /p "|dc -`
#afterdot=`echo $tpts | awk -F . '{print \$2}'`
#foo=`echo $afterdot|grep [123456798]`
#if [ ! "$foo" = "" ]; then
# echo "wrong number of slices somewhere - exiting"
# exit 1
#fi
#tpts=`echo "$tpts \* $tsize" |bc"'
#xsize=`avwval big4D dim1`
#ysize=`avwval big4D dim2`
#xvoxsize=`avwval big4D pixdim1`
#yvoxsize=`avwval big4D pixdim2`
#zvoxsize=`avwval big4D pixdim3`
#datatype=`avwval big4D datatype`
#avwcreatehd $xsize $ysize $nslices $tpts $xvoxsize $yvoxsize $zvoxsize 0 0 0 0# $datatype big4D
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment