@@ -32,65 +32,63 @@ class ReorientOutputSpec(TraitedSpec):
32
32
class Reorient (SimpleInterface ):
33
33
"""Conform an image to a given orientation
34
34
35
- Flips and reorder the image data array so that the axes match the
36
- directions indicated in ``orientation``.
37
- The default ``RAS`` orientation corresponds to the first axis being ordered
38
- from left to right, the second axis from posterior to anterior, and the
39
- third axis from inferior to superior.
35
+ Flips and reorder the image data array so that the axes match the
36
+ directions indicated in ``orientation``.
37
+ The default ``RAS`` orientation corresponds to the first axis being ordered
38
+ from left to right, the second axis from posterior to anterior, and the
39
+ third axis from inferior to superior.
40
40
41
- For oblique images, the original orientation is considered to be the
42
- closest plumb orientation.
41
+ For oblique images, the original orientation is considered to be the
42
+ closest plumb orientation.
43
43
44
- No resampling is performed, and thus the output image is not de-obliqued
45
- or registered to any other image or template.
44
+ No resampling is performed, and thus the output image is not de-obliqued
45
+ or registered to any other image or template.
46
46
47
- The effective transform is calculated from the original affine matrix to
48
- the reoriented affine matrix.
47
+ The effective transform is calculated from the original affine matrix to
48
+ the reoriented affine matrix.
49
49
50
- Examples
51
- --------
50
+ Examples
51
+ --------
52
52
53
- .. testsetup::
53
+ If an image is not reoriented, the original file is not modified
54
+
55
+ .. testsetup::
54
56
55
57
>>> def print_affine(matrix):
56
58
... print(str(matrix).replace(']', ' ').replace('[', ' '))
57
59
58
- .. doctest::
59
-
60
- If an image is not reoriented, the original file is not modified
61
-
62
- >>> import numpy as np
63
- >>> from nipype.interfaces.image import Reorient
64
- >>> reorient = Reorient(orientation='LPS')
65
- >>> reorient.inputs.in_file = 'segmentation0.nii.gz'
66
- >>> res = reorient.run()
67
- >>> res.outputs.out_file
68
- 'segmentation0.nii.gz'
69
-
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.
75
-
76
- >>> reorient.inputs.orientation = 'RAS'
77
- >>> res = reorient.run()
78
- >>> res.outputs.out_file # doctest: +ELLIPSIS
79
- '.../segmentation0_ras.nii.gz'
80
-
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.
86
-
87
- .. testcleanup::
88
-
89
- >>> import os
90
- >>> os.unlink(res.outputs.out_file)
91
- >>> os.unlink(res.outputs.transform)
92
-
93
- """
60
+ >>> import numpy as np
61
+ >>> from nipype.interfaces.image import Reorient
62
+ >>> reorient = Reorient(orientation='LPS')
63
+ >>> reorient.inputs.in_file = 'segmentation0.nii.gz'
64
+ >>> res = reorient.run()
65
+ >>> res.outputs.out_file
66
+ 'segmentation0.nii.gz'
67
+
68
+ >>> print_affine(np.loadtxt(res.outputs.transform))
69
+ 1. 0. 0. 0.
70
+ 0. 1. 0. 0.
71
+ 0. 0. 1. 0.
72
+ 0. 0. 0. 1.
73
+
74
+ >>> reorient.inputs.orientation = 'RAS'
75
+ >>> res = reorient.run()
76
+ >>> res.outputs.out_file # doctest: +ELLIPSIS
77
+ '.../segmentation0_ras.nii.gz'
78
+
79
+ >>> print_affine(np.loadtxt(res.outputs.transform))
80
+ -1. 0. 0. 60.
81
+ 0. -1. 0. 72.
82
+ 0. 0. 1. 0.
83
+ 0. 0. 0. 1.
84
+
85
+ .. testcleanup::
86
+
87
+ >>> import os
88
+ >>> os.unlink(res.outputs.out_file)
89
+ >>> os.unlink(res.outputs.transform)
90
+
91
+ """
94
92
input_spec = ReorientInputSpec
95
93
output_spec = ReorientOutputSpec
96
94
0 commit comments