Skip to content

Commit f683c59

Browse files
committed
TST: Fixes doctest.
The vectors need to be read *in light of the image orientation*
1 parent 691fde9 commit f683c59

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dmriprep/utils/vectors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ def __init__(
5858
>>> os.chdir(tmpdir)
5959
>>> old_rasb = str(data_dir / 'dwi.tsv')
6060
>>> old_rasb_mat = np.loadtxt(str(data_dir / 'dwi.tsv'), skiprows=1)
61+
>>> from dmriprep.utils.vectors import bvecs2ras
6162
>>> check = DiffusionGradientTable(
6263
... dwi_file=str(data_dir / 'dwi.nii.gz'),
6364
... rasb_file=str(data_dir / 'dwi.tsv'))
65+
>>> # Conform to the orientation of the image:
66+
>>> old_rasb_mat[:, :3] = bvecs2ras(check.affine, old_rasb_mat[:, :3])
6467
>>> affines = np.zeros((old_rasb_mat.shape[0], 4, 4))
6568
>>> aff_file_list = []
6669
>>> for ii, aff in enumerate(affines):
@@ -69,7 +72,7 @@ def __init__(
6972
... aff_file_list.append(aff_file)
7073
>>> check._transforms = aff_file_list
7174
>>> out_rasb_mat = check.reorient_rasb()
72-
>>> assert np.allclose(old_rasb_mat, out_rasb_mat)
75+
>>> np.allclose(old_rasb_mat, out_rasb_mat)
7376
True
7477
"""
7578
self._transforms = transforms

0 commit comments

Comments
 (0)