dipy logo

Site Navigation

NIPY Community

Previous topic

dipy.io.pickles

Next topic

dipy.io.dpy

dipy.io.bvectxt

dipy.io.bvectxt.orientation_from_string(string_ornt)

Returns an array representation of an ornt string

dipy.io.bvectxt.orientation_to_string(ornt)

Returns a string representation of a 3d ornt

dipy.io.bvectxt.ornt_mapping(ornt1, ornt2)

Calculates the mapping needing to get from orn1 to orn2

dipy.io.bvectxt.read_bvec_file(filename, atol=0.001)

Read gradient table information from a pair of files with extentions .bvec and .bval. The bval file should have one row of values representing the bvalues of each volume in the dwi data set. The bvec file should have three rows, where the rows are the x, y, and z components of the normalized gradient direction for each of the volumes.

Parameters :

filename : :

The path to the either the bvec or bval file

atol : float, optional

The tolorance used to check all the gradient directions are normalized. Defult is .001

dipy.io.bvectxt.reorient_vectors(input, current_ornt, new_ornt, axis=0)

Changes the orientation of a gradients or other vectors

Moves vectors, storted along axis, from current_ornt to new_ornt. For example the vector [x, y, z] in “RAS” will be [-x, -y, z] in “LPS”.

R: Right A: Anterior S: Superior L: Left P: Posterior I: Inferior

Examples

>>> gtab = np.array([[1, 1, 1], [1, 2, 3]])
>>> reorient_vectors(gtab, 'ras', 'asr', axis=1)
array([[1, 1, 1],
       [2, 3, 1]])
>>> reorient_vectors(gtab, 'ras', 'lps', axis=1)
array([[-1, -1,  1],
       [-1, -2,  3]])
>>> bvec = gtab.T
>>> reorient_vectors(bvec, 'ras', 'lps', axis=0)
array([[-1, -1],
       [-1, -2],
       [ 1,  3]])
>>> reorient_vectors(bvec, 'ras', 'lsp')
array([[-1, -1],
       [ 1,  3],
       [-1, -2]])