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

allow 3xN and Nx3 bvecs, as well as 1xN and Nx1 bvals

parent 69adbbf3
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 data_dir"
exit 1;
......@@ -39,20 +40,32 @@ if [ `${FSLDIR}/bin/imtest ${DIR}/data` -eq 1 -a `${FSLDIR}/bin/imtest ${DIR}/no
echo "data dimensions do not match mask dimensions"
fi
bvallen=`cat ${DIR}/bvals|grep -v "^[ ]*$"|wc -w`
bvallenw=`cat ${DIR}/bvals|wc -w`
bvallenl=`cat ${DIR}/bvals|grep -v "^[ ]*$"|wc -l`
bvallen=`echo "$bvallenw / $bvallenl"|bc`
bveclenw=`cat ${DIR}/bvecs|wc -w`
bveclenl=`cat ${DIR}/bvecs|grep -v "^[ ]*$"|wc -l`
bveclen=`echo "$bveclenw / $bveclenl"|bc`
if [ $bveclen -ne $bvallen ];then
if [ $bveclenl -ne 3 -a $bveclen -ne 3 ];then
echo "bvecs is not 3xN or Nx3 format"
fi
if [ $bvallenl -ge 2 -a $bvallen -ge 2 ];then
echo "bvals is not 1xN or Nx1 format"
fi
if [ $bveclen -ne $bvallenw -a $bveclenl -ne $bvallenw ];then
echo "bvecs and bvals are incompatible"
fi
if [ $bvallen -ne $dt ];then
if [ $bvallenw -ne $dt ];then
echo "number of elements in bvals is not equal to number of vols in data"
fi
if [ $bveclen -ne $dt ];then
echo "number of elements per line in bvecs is not equal to number of vols in data"
if [ $bveclen -ne $dt -a $bveclenl -ne $dt ];then
echo "number of vectors in bvecs is not equal to number of vols in data"
fi
fi
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