From aafd587e405352ecb564bbcc34a4afd23eaaa9be Mon Sep 17 00:00:00 2001
From: Martin Craig <martin.craig@eng.ox.ac.uk>
Date: Tue, 11 Sep 2018 15:01:39 +0100
Subject: [PATCH] Add FSL_ANAT wrapper

---
 fsl/wrappers/__init__.py |  1 +
 fsl/wrappers/fsl_anat.py | 48 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 fsl/wrappers/fsl_anat.py

diff --git a/fsl/wrappers/__init__.py b/fsl/wrappers/__init__.py
index 3a0297a3e..52ca6904f 100644
--- a/fsl/wrappers/__init__.py
+++ b/fsl/wrappers/__init__.py
@@ -82,6 +82,7 @@ from .bet          import (bet,             # noqa
 from .eddy         import (eddy_cuda,       # noqa
                            topup)
 from .fast         import (fast,)           # noqa
+from .fsl_anat     import (fsl_anat,)       # noqa
 from .flirt        import (flirt,           # noqa
                            invxfm,
                            applyxfm,
diff --git a/fsl/wrappers/fsl_anat.py b/fsl/wrappers/fsl_anat.py
new file mode 100644
index 000000000..b1c2494d4
--- /dev/null
+++ b/fsl/wrappers/fsl_anat.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# fsl_anat.py - Wrapper for the FSL_ANAT command.
+#
+# Author: Martin Craig <martin.craig@eng.ox.ac.uk>
+#
+"""This module provides the :func:`fsl_anat` function, a wrapper for the FSL
+`FSL_ANAT <https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/fsl_anat>`_ command.
+"""
+
+import six
+
+import fsl.utils.assertions as asrt
+from . import wrapperutils  as wutils
+
+@wutils.fileOrImage('img', outprefix='out')
+@wutils.fslwrapper
+def fsl_anat(img, out='fsl_anat', **kwargs):
+    """Wrapper for the ``fsl_anat`` command.
+
+    :arg img:       Input structural image
+    :arg out:       Output directory name
+    """
+    asrt.assertIsNifti(img)
+
+    valmap = {
+        'weakbias' : wutils.SHOW_IF_TRUE,
+        'noreorient' : wutils.SHOW_IF_TRUE,
+        'nocrop' : wutils.SHOW_IF_TRUE,
+        'nobias' : wutils.SHOW_IF_TRUE,
+        'noreg' : wutils.SHOW_IF_TRUE,
+        'nononlinreg' : wutils.SHOW_IF_TRUE,
+        'noseg' : wutils.SHOW_IF_TRUE,
+        'nosubcortseg' : wutils.SHOW_IF_TRUE,
+        'nosearch' : wutils.SHOW_IF_TRUE,
+        'betfparam' : wutils.SHOW_IF_TRUE,
+        'nocleanup' : wutils.SHOW_IF_TRUE,
+    }
+
+    argmap = {
+        'bias_smoothing' : 's',
+        'img_type' : 't',
+    }
+
+    cmd  = ['fsl_anat', '-i', img, '-o', out]
+    cmd += wutils.applyArgStyle('--=', valmap=valmap, argmap=argmap, singlechar_args=True, **kwargs)
+
+    return cmd
-- 
GitLab