Seems like you have to flip your vectors in the encoding.b table. If you use mrconvert to get from dicoms to .mif you should not have this problem. <br><br>However, if you used dcm2nii or something else, the direction of the gradient diffusions may be flipped. You can fix this by multiplying the first, second or third column of your encoding.b table by -1 (combinations of xy, yz or even xyz are allowed). This is a trial and error process, for the most part, but once you get it right (and assuming you do not modify your scanning parameters) you can apply the same modification to all your gradient tables.<br>
<br>An example script for flipping your bvecs is below. Use the arguments -flip_x, -flip_y and/or -flip_z to taste. I recommend that you perform CSD with lmax=2 then display your ODFs in mrview iteratively until you find a combination of flips that works for your data.<br>
<br>Good luck.<br><br>Luis<br><br>#!/bin/bash<br><br>bvecsIN=$1<br>bvecsOUT=$2<br><br><br>print_help()<br>{<br> echo ""<br> echo "`basename $0` <bvecsIN> <bvecsOUT> [-options]"<br> echo ""<br>
echo "Options:"<br> echo " -flip_x"<br> echo " -flip_y"<br> echo " -flip_z"<br> echo ""<br> echo "Luis Concha - INB, UNAM"<br> echo "July 2010"<br>
echo ""<br><br>}<br><br><br><br>for arg in "$@"<br>do<br><br> case "$arg" in<br> -h|-help) <br> print_help<br> exit 1<br> ;;<br> esac<br>done<br><br><br>
<br><br>x=`head -n 1 $bvecsIN | tail -n 1`<br>y=`head -n 2 $bvecsIN | tail -n 1`<br>z=`head -n 3 $bvecsIN | tail -n 1`<br><br><br>xx=$x<br>yy=$y<br>zz=$z<br>for arg in "$@"<br>do<br><br> case "$arg" in<br>
-flip_x)<br> echo "Will flip x component"<br> xx=""<br> for v in $x<br> do<br> vv=`echo "$v * -1" | bc -l`<br> xx="$xx $vv"<br>
done<br>
;;<br> -flip_y)<br> echo "Will flip y component"<br> yy=""<br> for v in $y<br> do<br> vv=`echo "$v * -1" | bc -l`<br> yy="$yy $vv"<br>
done<br> ;;<br> -flip_z)<br> echo "Will flip z component"<br> zz=""<br> for v in $z<br> do<br> vv=`echo "$v * -1" | bc -l`<br> zz="$zz $vv"<br>
done<br> ;;<br> esac<br> index=$[$index+1]<br>done<br><br>echo $xx > $bvecsOUT<br>echo $yy >> $bvecsOUT<br>echo $zz >> $bvecsOUT<br><br><br><br><br><br><br clear="all">Dr. Luis Concha<br>
Instituto de Neurobiología<br>Laboratorio C-12<br>UNAM, Campus Juriquilla<br>Boulervard Juriquilla 3001<br>Juriquilla, Querétaro.<br>C.P. 76230<br>México<br>Tel (442) 2 38 10 53<br>Fax (442) 2 38 10 46<br><a href="http://www.inb.unam.mx" target="_blank">www.inb.unam.mx</a><br>
<br>
<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote><br>