diff --git a/fsl/wrappers/__init__.py b/fsl/wrappers/__init__.py index 8363c6d5a92460fd4222894dc45642dc892b2bf1..3a0297a3ef7af4574087ff3e4f3ace977d1b8d3f 100644 --- a/fsl/wrappers/__init__.py +++ b/fsl/wrappers/__init__.py @@ -81,6 +81,7 @@ from .bet import (bet, # noqa robustfov) from .eddy import (eddy_cuda, # noqa topup) +from .fast import (fast,) # noqa from .flirt import (flirt, # noqa invxfm, applyxfm, diff --git a/fsl/wrappers/fast.py b/fsl/wrappers/fast.py new file mode 100644 index 0000000000000000000000000000000000000000..1c12a363f8d79639d337f8c742e3dc1dcae1edc0 --- /dev/null +++ b/fsl/wrappers/fast.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# fast.py - Wrapper for the FSL fast command. +# +# Author: Martin Craig <martin.craig@eng.ox.ac.uk> +# Paul McCarthy <pauldmccarthy@gmail.com> +# +"""This module provides the :func:`fast` function, a wrapper for the FSL +`FAST <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FAST>`_ command. +""" + + +import six + +import fsl.utils.assertions as asrt +from . import wrapperutils as wutils + + +@wutils.fileOrImage('imgs', 'A', 's', 'manualseg', outprefix='out') +@wutils.fileOrArray('a') +@wutils.fslwrapper +def fast(imgs, out="fast", **kwargs): + """Wrapper for the ``fast`` command. + + :arg imgs: Input image(s) + :arg out: Output basename + :arg n_classes: Number of tissue classes (corresponds to the ``--class`` + command line option) + """ + + if isinstance(imgs, six.string_types): + imgs = [imgs] + + for i in imgs: + asrt.assertIsNifti(imgs) + + argmap = { + 'n_classes' : 'class', + } + + cmd = ['fast', '-v', '--out=%s' % out] + cmd += wutils.applyArgStyle('--=', argmap=argmap, **kwargs) + cmd += imgs + + return cmd