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 1
1
import pytest
2
2
import numpy
3
3
import os
4
- from distutils .version import LooseVersion
5
4
6
5
DATADIR = os .path .realpath (
7
6
os .path .join (os .path .dirname (__file__ ), 'testing/data' ))
@@ -20,5 +19,3 @@ def in_testing(request):
20
19
# This seems to be a reliable way to distinguish tests from doctests
21
20
if request .function is None :
22
21
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):
50
50
Examples
51
51
--------
52
52
53
+ .. testsetup::
54
+
55
+ >>> def print_affine(matrix):
56
+ ... print(str(matrix).translate(dict(zip(b'[]', ' '))))
57
+
58
+ .. doctest::
59
+
53
60
If an image is not reoriented, the original file is not modified
54
61
55
62
>>> import numpy as np
@@ -60,22 +67,22 @@ class Reorient(SimpleInterface):
60
67
>>> res.outputs.out_file
61
68
'segmentation0.nii.gz'
62
69
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.
68
75
69
76
>>> reorient.inputs.orientation = 'RAS'
70
77
>>> res = reorient.run()
71
78
>>> res.outputs.out_file # doctest: +ELLIPSIS
72
79
'.../segmentation0_ras.nii.gz'
73
80
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.
79
86
80
87
.. testcleanup::
81
88
You can’t perform that action at this time.
0 commit comments