diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a8164678633d10f397a1970d934643edc0cc9e16..9ad4ee613fa477ff4f90a20ad91b411cd6cb0843 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,17 @@ This document contains the ``fslpy`` release history in reverse chronological order. +3.19.0 (Under development) +-------------------------- + + +Added +^^^^^ + + +* New :func:`.bedpostx_postproc` wrapper function (!454). + + 3.18.3 (Saturday 4th May 2024) ------------------------------ diff --git a/fsl/tests/test_wrappers/test_wrappers.py b/fsl/tests/test_wrappers/test_wrappers.py index b391337069a23497eb84d18d4c509b69639745e9..cca8c26dd240abdc10979ada84302c3ad600d2e6 100755 --- a/fsl/tests/test_wrappers/test_wrappers.py +++ b/fsl/tests/test_wrappers/test_wrappers.py @@ -578,6 +578,15 @@ def test_split_parts_gpu(): assert res.stdout[0] == exp +def test_bedpostx_postproc(): + with testenv('bedpostx_postproc.sh') as bpg: + res = fw.bedpostx_postproc('data', 'mask', 'bvecs', 'bvals', + 100, 10, 'subdir', 'bindir', nf=20) + exp = f'{bpg} --data=data --mask=mask --bvecs=bvecs --bvals=bvals ' \ + '--nf=20 100 10 subdir bindir' + assert res.stdout[0] == exp + + def test_bedpostx_postproc_gpu(): with testenv('bedpostx_postproc_gpu.sh') as bpg: res = fw.bedpostx_postproc_gpu('data', 'mask', 'bvecs', 'bvals', diff --git a/fsl/wrappers/__init__.py b/fsl/wrappers/__init__.py index 6cba0e0262a13771824aa24872755672067c1d73..bed50b2645baff4c9def31deb4b3ecbefc520b7b 100755 --- a/fsl/wrappers/__init__.py +++ b/fsl/wrappers/__init__.py @@ -166,6 +166,7 @@ from fsl.wrappers.bedpostx import (xfibres, xfibres_gpu, split_parts_gpu, bedpostx_postproc_gpu, + bedpostx_postproc, probtrackx, probtrackx2, probtrackx2_gpu) diff --git a/fsl/wrappers/bedpostx.py b/fsl/wrappers/bedpostx.py index d9a9b7e2feda3cb8e89cc367b6a7a164237ec63c..075af9698890282b9702ee54196f8d7e06256f02 100644 --- a/fsl/wrappers/bedpostx.py +++ b/fsl/wrappers/bedpostx.py @@ -14,6 +14,7 @@ commands. xfibres xfibres_gpu split_parts_gpu + bedpostx_postproc bedpostx_postproc_gpu probtrackx probtrackx2 @@ -160,6 +161,27 @@ def bedpostx_postproc_gpu(data, mask, bvecs, bvals, TotalNumVoxels, return cmd +@wutils.fileOrImage('data', 'mask',) +@wutils.fileOrArray('bvecs', 'bvals') +@wutils.fslwrapper +def bedpostx_postproc(data, mask, bvecs, bvals, TotalNumVoxels, + TotalNumParts, SubjectDir, bindir, **kwargs): + """Wrapper for the ``bedpostx_postproc`` command.""" + + asrt.assertFileExists(data, bvecs, bvals) + asrt.assertIsNifti(mask) + + cmd = ['bedpostx_postproc.sh', + '--data=' + data, + '--mask=' + mask, + '--bvecs=' + bvecs, + '--bvals=' + bvals] + + cmd += wutils.applyArgStyle('--=', valmap=XFIBRES_VALMAP, **kwargs) + cmd += [str(TotalNumVoxels), str(TotalNumParts), SubjectDir, bindir] + return cmd + + @wutils.fileOrImage('mask', 'seed') @wutils.fslwrapper def probtrackx(samples, mask, seed, **kwargs):