Skip to content
Snippets Groups Projects
Commit 20165ae8 authored by Saad Jbabdi's avatar Saad Jbabdi
Browse files

back to copying input. this time it's called bvecs_unrotated

parent 30584c97
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
if [ "$2" == "" ];then if [ "$2" == "" ];then
echo "" echo ""
echo "Usage: rotate_bvecs <ecclogfile> <bvecs>" echo "Usage: rotate_bvecs <ecclogfile> <bvecs>"
echo "used to update bvecs based on eddy correction" echo "will save bvecs file into <bvecs>_unrotated and create new bvecs file called <bvecs>"
echo "will create a new bvecs file called <bvecs>_rot"
echo "" echo ""
exit 1 exit 1
fi fi
...@@ -12,21 +11,22 @@ fi ...@@ -12,21 +11,22 @@ fi
ecclog=$1 ecclog=$1
bvecs=$2 bvecs=$2
if [ -f ${bvecs}_rot ];then if [ -f ${bvecs}_unrotated ];then
echo "" echo ""
echo "Error: Found that ${bvecs}_rot already exists" echo "Error: Found that ${bvecs}_unrotated already exists"
echo "This probably means that you have run this script before." echo "This probably means that you have run this script before. Be aware that this also means ${bvecs} have already been rotated!"
echo "To get this program to run, please remove the file ${bvecs}_rot" echo "If you want to force this program to run, please remove the file ${bvecs}_unrotated"
echo "" echo ""
exit 1 exit 1
fi fi
/bin/cp ${bvecs} ${bvecs}_unrotated
#/bin/rm -f ${bvecs}
# this only works if the bvecs are in lines... # this only works if the bvecs are in lines...
Xs=$(cat ${bvecs} | head -1 | tail -1) Xs=$(cat ${bvecs}_unrotated | head -1 | tail -1)
Ys=$(cat ${bvecs} | head -2 | tail -1) Ys=$(cat ${bvecs}_unrotated | head -2 | tail -1)
Zs=$(cat ${bvecs} | head -3 | tail -1) Zs=$(cat ${bvecs}_unrotated | head -3 | tail -1)
rnd=${$} rnd=${$}
cat ${ecclog} | while read line; do cat ${ecclog} | while read line; do
...@@ -96,7 +96,7 @@ for matfile in /tmp/grot${rnd}_*.mat;do ...@@ -96,7 +96,7 @@ for matfile in /tmp/grot${rnd}_*.mat;do
i=$(echo "$i + 1" | bc) ; i=$(echo "$i + 1" | bc) ;
done done
echo "$rXs" > ${bvecs}_rot; echo "$rXs" > ${bvecs};
echo "$rYs" >> ${bvecs}_rot; echo "$rYs" >> ${bvecs};
echo "$rZs" >> ${bvecs}_rot; echo "$rZs" >> ${bvecs};
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