diff --git a/nipype/interfaces/fsl/__init__.py b/nipype/interfaces/fsl/__init__.py index 040f0260af..0c5e1bc317 100644 --- a/nipype/interfaces/fsl/__init__.py +++ b/nipype/interfaces/fsl/__init__.py @@ -15,7 +15,7 @@ from .utils import (Smooth, Merge, ExtractROI, Split, ImageMaths, ImageMeants, ImageStats, FilterRegressor, Overlay, Slicer, PlotTimeSeries, PlotMotionParams, ConvertXFM, - SwapDimensions, PowerSpectrum) + SwapDimensions, PowerSpectrum, Reorient2Std) from .dti import (EddyCorrect, BEDPOSTX, DTIFit, ProbTrackX, VecReg, ProjThresh, FindTheBiggest, DistanceMap, TractSkeleton, XFibres, MakeDyadicVectors) diff --git a/nipype/interfaces/fsl/utils.py b/nipype/interfaces/fsl/utils.py index d3a21abd8a..8bec722598 100644 --- a/nipype/interfaces/fsl/utils.py +++ b/nipype/interfaces/fsl/utils.py @@ -1151,3 +1151,39 @@ def _list_outputs(self): outputs['exf_mask'] = self._gen_fname(cwd=self.inputs.tmpdir, basename='maskexf') return outputs + +class Reorient2StdInputSpec(FSLCommandInputSpec): + in_file = File(exists=True, mandatory=True, argstr="%s") + out_file = File(genfile=True, hash_files=False, argstr="%s") + +class Reorient2StdOutputSpec(TraitedSpec): + out_file = File(exists=True) + +class Reorient2Std(FSLCommand): + """fslreorient2std is a tool for reorienting the image to match the + approximate orientation of the standard template images (MNI152). + + Examples + -------- + >>> reorient = Reorient2Std() + >>> reorient.inputs.in_file = "functional.nii" + >>> res = reorient.run() # doctest: +SKIP + + + """ + _cmd = 'fslreorient2std' + input_spec = Reorient2StdInputSpec + output_spec = Reorient2StdOutputSpec + + def _gen_filename(self, name): + if name == 'out_file': + return self._gen_fname(self.inputs.in_file, + suffix="_reoriented") + return None + + def _list_outputs(self): + outputs = self.output_spec().get() + if not isdefined(self.inputs.out_file): + outputs['out_file'] = self._gen_filename('out_file') + else: + outputs['out_file'] = os.path.abspath(self.inputs.out_file)