@@ -32,65 +32,63 @@ class ReorientOutputSpec(TraitedSpec):
3232class Reorient (SimpleInterface ):
3333 """Conform an image to a given orientation
3434
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.
4040
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.
4343
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.
4646
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.
4949
50- Examples
51- --------
50+ Examples
51+ --------
5252
53- .. testsetup::
53+ If an image is not reoriented, the original file is not modified
54+
55+ .. testsetup::
5456
5557 >>> def print_affine(matrix):
5658 ... print(str(matrix).replace(']', ' ').replace('[', ' '))
5759
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+ """
9492 input_spec = ReorientInputSpec
9593 output_spec = ReorientOutputSpec
9694
0 commit comments