Convert BrainVoyager gradient file to FSL bvecs and bvals and vice versa
- Details
- Category: Interaction With Other Software
- Last Updated: 23 October 2020
- Published: 16 April 2018
- Hits: 3294
First, install NeuroElf (formerly BVQXTools) on your computer. See www.neuroelf.net .
BrainVoyager to FSL format
To convert a BrainVoyager grb file to a FSL bvec and bval pair, run the following in Matlab:
>> grb = xff('*.grb'); % read BV gradient file
>> g = grb.Gradients;
>> g = g';
>> g(3,:) = -g(3,:); % z = -z check this in your data!
>> dlmwrite('bvecs',g,'delimiter',' ');
>> bval = 1000 % change to suit your measurement
>> i = sum(g,1)~=0;
>> b = bval * i;
>> dlmwrite('bvals',b,'delimiter',' ');
FSL to BrainVoyager
g=dlmread('LORAX_20110609_360772728_1201_DTI_32d_2mm_SF3_SENSE_bvecs.grb', ' ');
g=g'
grb=BVQXfile('new:grb')
g(:,3)=-g(:,3);
grb.Gradients=g;
grb.NrOfEntries = length(g)
grb.IncludeBValues = 'no'
grb.SaveAs
[filename,pathname] = uigetfile('*.bvec','Please select the textfile containing gradients')
g = dlmread([pathname filename]);
g = g';
grb = xff('new:grb')
g(:,3) = -g(:,3); %polarity change of z-component. CHECK this!
grb.Gradients = g;
grb.NrOfEntries = length(g);
grb.IncludeBValues = 'no';
grb.SaveAs