Skip to content

Commit 4ff18c8

Browse files
committed
Merge pull request #453 from chrisfilo/enh/fslreorient
Added reorient2std interface
2 parents 9031b92 + d08b801 commit 4ff18c8

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

nipype/interfaces/fsl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .utils import (Smooth, Merge, ExtractROI, Split, ImageMaths, ImageMeants,
1616
ImageStats, FilterRegressor, Overlay, Slicer,
1717
PlotTimeSeries, PlotMotionParams, ConvertXFM,
18-
SwapDimensions, PowerSpectrum)
18+
SwapDimensions, PowerSpectrum, Reorient2Std)
1919
from .dti import (EddyCorrect, BEDPOSTX, DTIFit, ProbTrackX, VecReg, ProjThresh,
2020
FindTheBiggest, DistanceMap, TractSkeleton, XFibres,
2121
MakeDyadicVectors)

nipype/interfaces/fsl/utils.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,3 +1151,39 @@ def _list_outputs(self):
11511151
outputs['exf_mask'] = self._gen_fname(cwd=self.inputs.tmpdir,
11521152
basename='maskexf')
11531153
return outputs
1154+
1155+
class Reorient2StdInputSpec(FSLCommandInputSpec):
1156+
in_file = File(exists=True, mandatory=True, argstr="%s")
1157+
out_file = File(genfile=True, hash_files=False, argstr="%s")
1158+
1159+
class Reorient2StdOutputSpec(TraitedSpec):
1160+
out_file = File(exists=True)
1161+
1162+
class Reorient2Std(FSLCommand):
1163+
"""fslreorient2std is a tool for reorienting the image to match the
1164+
approximate orientation of the standard template images (MNI152).
1165+
1166+
Examples
1167+
--------
1168+
>>> reorient = Reorient2Std()
1169+
>>> reorient.inputs.in_file = "functional.nii"
1170+
>>> res = reorient.run() # doctest: +SKIP
1171+
1172+
1173+
"""
1174+
_cmd = 'fslreorient2std'
1175+
input_spec = Reorient2StdInputSpec
1176+
output_spec = Reorient2StdOutputSpec
1177+
1178+
def _gen_filename(self, name):
1179+
if name == 'out_file':
1180+
return self._gen_fname(self.inputs.in_file,
1181+
suffix="_reoriented")
1182+
return None
1183+
1184+
def _list_outputs(self):
1185+
outputs = self.output_spec().get()
1186+
if not isdefined(self.inputs.out_file):
1187+
outputs['out_file'] = self._gen_filename('out_file')
1188+
else:
1189+
outputs['out_file'] = os.path.abspath(self.inputs.out_file)

0 commit comments

Comments
 (0)