@@ -30,7 +30,53 @@ class ReorientOutputSpec(TraitedSpec):
30
30
31
31
32
32
class Reorient (SimpleInterface ):
33
- """Reorient an image
33
+ """Conform an image to a given orientation
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.
40
+
41
+ For oblique images, the original orientation is considered to be the
42
+ closest plumb orientation.
43
+
44
+ No resampling is performed, and thus the output image is not de-obliqued
45
+ or registered to any other image or template.
46
+
47
+ The effective transform is calculated from the original affine matrix to
48
+ the reoriented affine matrix.
49
+
50
+ Examples
51
+ --------
52
+
53
+ If an image is not reoriented, the original file is not modified
54
+
55
+ >>> import numpy as np
56
+ >>> from nipype.interfaces.image import Reorient
57
+ >>> reorient = Reorient(orientation='LPS')
58
+ >>> reorient.inputs.in_file = 'segmentation0.nii.gz'
59
+ >>> res = reorient.run()
60
+ >>> res.outputs.out_file
61
+ 'segmentation0.nii.gz'
62
+
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.]]
68
+
69
+ >>> reorient.inputs.orientation = 'RAS'
70
+ >>> res = reorient.run()
71
+ >>> res.outputs.out_file # doctest: +ELLIPSIS
72
+ '.../segmentation0_ras.nii.gz'
73
+
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.]]
79
+
34
80
"""
35
81
input_spec = ReorientInputSpec
36
82
output_spec = ReorientOutputSpec
0 commit comments