nipy/nipype — pull request #543 by steelec (2013-04-02 09:10:04+00:00)
Title: Bug fix rotate bvec

noted issues: FA files looked funny after processing with this pipeline, the first two entries in the rotated_bvec files were 0,0,0 when the bvalues of the first two files were 0 and 1000.

Plotting the original bvec against the rotated bvec (X component) showed what appeared to be a single volume offset (see black and red traces in attached plot)

code issue: _rotate_bvec code initialised its output bvec array with the first entry of the input bvec array and then looped through FLIRT matrices starting at 1st position, but used a 0-based index for selecting the input from the bvec array

solution : initialise output array filled with zeros, loop through FLIRT matrices from 0, use 0-based indexing for selecting input from the bvec array, set consecutive elements appropriately

testing : nothing, other than plotting the X component for one subject

I attached the plot, where black = original bvec, red = rotated bvec, green = rotated bvec with my solution. The other thing that you can see in this plot is that there are regularly spaced x=0s in both the original and my version where the b=0 volumes were collected (7 in total).

(This also includes the changes that I made in the previous pull request.)
![_rotate_bvec_issues](https://f.cloud.github.com/assets/2734273/327466/c362bf9e-9b74-11e2-84b5-97c3381674a9.png)