diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e67cb6f509f813beb0e6f0c851ef932059b7046c..9610153409f8013003eed4c202a2a9a151d1a459 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ Added * Added more functions to the :class:`.fslmaths` wrapper (!431). * New :func:`.smoothest` wrapper function (!432). * New :func:`.get_standard` wrapper function (!433). +* New :func:`.vecreg` wrapper function (!434). 3.15.4 (Monday 27th November 2023) diff --git a/fsl/tests/test_wrappers/test_wrappers.py b/fsl/tests/test_wrappers/test_wrappers.py index e48e9d6d9515586f31a0854db01109172e19f56f..214584ab779120fe9fefb2ec4ff9301e6fc26055 100755 --- a/fsl/tests/test_wrappers/test_wrappers.py +++ b/fsl/tests/test_wrappers/test_wrappers.py @@ -541,6 +541,15 @@ def test_dtifit(): assert res.stdout[0] == exp +def test_vecreg(): + with testenv('vecreg') as vecreg: + res = fw.vecreg('in', 'out', 'ref', warpfield='warp', + premat='premat.mat', interp='sinc', m='mask') + exp = f'{vecreg} -i in -o out -r ref --warpfield=warp ' \ + '--premat=premat.mat --interp=sinc -m mask' + assert res.stdout[0] == exp + + def test_xfibres(): with testenv('xfibres') as xfibres: res = fw.xfibres('data', 'mask', 'bvecs', 'bvals', diff --git a/fsl/wrappers/__init__.py b/fsl/wrappers/__init__.py index 819a73c3eafd050fa393bd36c5c8822f0824a6c2..651cb4f85ac94292a2dad949b90a5e87cefe9765 100755 --- a/fsl/wrappers/__init__.py +++ b/fsl/wrappers/__init__.py @@ -158,7 +158,8 @@ from fsl.wrappers.bianca import (bianca, make_bianca_mask) from fsl.wrappers.feat import (feat, featquery) -from fsl.wrappers.dtifit import dtifit +from fsl.wrappers.fdt import (dtifit, + vecreg) from fsl.wrappers.bedpostx import (xfibres, xfibres_gpu, split_parts_gpu, diff --git a/fsl/wrappers/dtifit.py b/fsl/wrappers/fdt.py similarity index 60% rename from fsl/wrappers/dtifit.py rename to fsl/wrappers/fdt.py index 728d2b1eb3e5f8868c448923e38e5ff8abfa777b..586142a552150134cb66b0c7142368f082840326 100644 --- a/fsl/wrappers/dtifit.py +++ b/fsl/wrappers/fdt.py @@ -1,16 +1,27 @@ #!/usr/bin/env python # -# dtifit.py - Wrapper for dtifit. +# fdt.py - Wrappers for FDT commands. # -# Author: Fidel Alfaro Almagro <fidel.alfaroalmagro@ndcn.ox.ac.uk> +# Author: Paul McCarthy <pauldmccarthy@gmail.com> # -"""This module provides wrapper functions for the FSL `dtifit -<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FDT>`_ command. -""" +"""This module contains wrapper functions for various FDT commands. """ -import fsl.utils.assertions as asrt -from . import wrapperutils as wutils +import fsl.utils.assertions as asrt +import fsl.wrappers.wrapperutils as wutils + + +@wutils.fileOrImage('input', 'output', 'ref', 'warpfield', + 'rotwarp', 'mask', 'refmask') +@wutils.fileOrArray('affine', 'premat', 'postmat', 'rotmat') +@wutils.fslwrapper +def vecreg(input, output, ref, **kwargs): + """Wrapper for the ``vecreg`` command. """ + + cmd = ['vecreg', '-i', input, '-o', output, '-r', ref] + cmd += wutils.applyArgStyle('--=', **kwargs) + + return cmd @wutils.fileOrImage('data', 'mask', 'field', outprefix='out')