File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 11import pytest
22import numpy
33import os
4- from distutils .version import LooseVersion
54
65DATADIR = os .path .realpath (
76 os .path .join (os .path .dirname (__file__ ), 'testing/data' ))
@@ -20,5 +19,3 @@ def in_testing(request):
2019 # This seems to be a reliable way to distinguish tests from doctests
2120 if request .function is None :
2221 os .chdir (DATADIR )
23- if LooseVersion (numpy .__version__ ) >= LooseVersion ('1.14' ):
24- numpy .set_printoptions (legacy = "1.13" )
Original file line number Diff line number Diff line change @@ -50,6 +50,13 @@ class Reorient(SimpleInterface):
5050 Examples
5151 --------
5252
53+ .. testsetup::
54+
55+ >>> def print_affine(matrix):
56+ ... print(str(matrix).translate(dict(zip(b'[]', ' '))))
57+
58+ .. doctest::
59+
5360 If an image is not reoriented, the original file is not modified
5461
5562 >>> import numpy as np
@@ -60,22 +67,22 @@ class Reorient(SimpleInterface):
6067 >>> res.outputs.out_file
6168 'segmentation0.nii.gz'
6269
63- >>> print (np.loadtxt(res.outputs.transform))
64- [[ 1. 0. 0. 0.]
65- [ 0. 1. 0. 0.]
66- [ 0. 0. 1. 0.]
67- [ 0. 0. 0. 1.]]
70+ >>> print_affine (np.loadtxt(res.outputs.transform))
71+ 1. 0. 0. 0.
72+ 0. 1. 0. 0.
73+ 0. 0. 1. 0.
74+ 0. 0. 0. 1.
6875
6976 >>> reorient.inputs.orientation = 'RAS'
7077 >>> res = reorient.run()
7178 >>> res.outputs.out_file # doctest: +ELLIPSIS
7279 '.../segmentation0_ras.nii.gz'
7380
74- >>> print (np.loadtxt(res.outputs.transform))
75- [[ -1. 0. 0. 60.]
76- [ 0. -1. 0. 72.]
77- [ 0. 0. 1. 0.]
78- [ 0. 0. 0. 1.]]
81+ >>> print_affine (np.loadtxt(res.outputs.transform))
82+ -1. 0. 0. 60.
83+ 0. -1. 0. 72.
84+ 0. 0. 1. 0.
85+ 0. 0. 0. 1.
7986
8087 .. testcleanup::
8188
You can’t perform that action at this time.
0 commit comments