diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bd49656fa72a595585c318bbc14dd7df0389c3c0..af5f1d8c66cf9bb018b8d81cfe867c04ea64a711 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,18 @@ This document contains the ``fslpy`` release history in reverse chronological order. +2.0.1 (Monday April 1st 2019) +----------------------------- + + +Fixed +^^^^^ + + +* Fixed a bug with the :func:`.gifti.relatedFiles` function returning + duplicate files. + + 2.0.0 (Friday March 20th 2019) ------------------------------ diff --git a/doc/fsl.utils.tempdir.rst b/doc/fsl.utils.tempdir.rst index 51b9f93c3c60fd3773a8c337341ad133bb47c2b2..1b8e80df07d18be7a8cf207086e623c8d6181dc5 100644 --- a/doc/fsl.utils.tempdir.rst +++ b/doc/fsl.utils.tempdir.rst @@ -1,5 +1,5 @@ -``fsl.utils.temdir`` -==================== +``fsl.utils.tempdir`` +===================== .. automodule:: fsl.utils.tempdir :members: diff --git a/doc/fsl.wrappers.fsl_anat.rst b/doc/fsl.wrappers.fsl_anat.rst new file mode 100644 index 0000000000000000000000000000000000000000..93d96ac0995aee957c15f14ace4b7fab751685ac --- /dev/null +++ b/doc/fsl.wrappers.fsl_anat.rst @@ -0,0 +1,7 @@ +``fsl.wrappers.fsl_anat`` +========================= + +.. automodule:: fsl.wrappers.fsl_anat + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/fsl.wrappers.rst b/doc/fsl.wrappers.rst index dfa190bfae732abb5fdfabd9e8d98ef1928acabd..818d5ff68e2925917d54cc217f2479480dca5d53 100644 --- a/doc/fsl.wrappers.rst +++ b/doc/fsl.wrappers.rst @@ -10,6 +10,7 @@ fsl.wrappers.flirt fsl.wrappers.fnirt fsl.wrappers.fslmaths + fsl.wrappers.fsl_anat fsl.wrappers.fugue fsl.wrappers.melodic fsl.wrappers.misc diff --git a/fsl/data/gifti.py b/fsl/data/gifti.py index 43ce2ec5a18b7e2c31a2fbf82bb96dfcb566bdd7..abd41f7d43e468136c08be7e418ec8cbdb0bda9f 100644 --- a/fsl/data/gifti.py +++ b/fsl/data/gifti.py @@ -333,7 +333,7 @@ def relatedFiles(fname, ftypes=None): related = [] for ftype in ftypes: - related.extend( - glob.glob(op.join(dirname, '{}*{}'.format(prefix, ftype)))) + hits = glob.glob(op.join(dirname, '{}*{}'.format(prefix, ftype))) + related.extend([h for h in hits if h not in related]) return [r for r in related if r != path] diff --git a/fsl/wrappers/wrapperutils.py b/fsl/wrappers/wrapperutils.py index 88db1dc92b7774cc683aedbd6e55dbeef25fb032..373bcf08b1a0c53af416a074cc4c439cf534f792 100644 --- a/fsl/wrappers/wrapperutils.py +++ b/fsl/wrappers/wrapperutils.py @@ -10,7 +10,7 @@ functions. -The :func:`cmdwrapper` and :func:`fslwrapper` functions are conenience +The :func:`cmdwrapper` and :func:`fslwrapper` functions are convenience decorators which allow you to write your wrapper function such that it simply generates the command-line needed to respectively run a standard shell command or a FSL command. For example:: @@ -39,7 +39,7 @@ patterns. For example:: The :func:`fileOrImage` and :func:`fileOrArray` functions can be used to decorate a wrapper function such that in-memory ``nibabel`` images or Numpy arrays can be passed in as arguments - they will be automatically saved out to -files, and then the file names passed into the wrapper function. For exmaple:: +files, and then the file names passed into the wrapper function. For example:: @fileOrImage('src', 'ref') @@ -225,18 +225,18 @@ def applyArgStyle(style, ========= ========== =========================== ``style`` ``valsep`` Result ========= ========== =========================== - ``'-'`` ' ' ``-name val1 val2 val3`` - ``'-'`` '"' ``-name "val1 val2 val3"`` - ``'-'`` ',' ``-name val1,val2,val3`` - ``'--'`` ' ' ``--name val1 val2 val3`` - ``'--'`` '"' ``--name "val1 val2 val3"`` - ``'--'`` ',' ``--name val1,val2,val3`` - ``'-='`` ' ' Not supported - ``'-='`` '"' ``-name="val1 val2 val3"`` - ``'-='`` ',' ``-name=val1,val2,val3`` - ``'--='`` ' ' Not supported - ``'--='`` '"' ``--name="val1 val2 val3"`` - ``'--='`` ',' ``--name=val1,val2,val3`` + ``'-'`` ``' '`` ``-name val1 val2 val3`` + ``'-'`` ``'"'`` ``-name "val1 val2 val3"`` + ``'-'`` ``','`` ``-name val1,val2,val3`` + ``'--'`` ``' '`` ``--name val1 val2 val3`` + ``'--'`` ``'"'`` ``--name "val1 val2 val3"`` + ``'--'`` ``','`` ``--name val1,val2,val3`` + ``'-='`` ``' '`` Not supported + ``'-='`` ``'"'`` ``-name="val1 val2 val3"`` + ``'-='`` ``','`` ``-name=val1,val2,val3`` + ``'--='`` ``' '`` Not supported + ``'--='`` ``'"'`` ``--name="val1 val2 val3"`` + ``'--='`` ``','`` ``--name=val1,val2,val3`` ========= ========== =========================== diff --git a/tests/test_gifti.py b/tests/test_gifti.py index ff6a9b1a3e51c96a48cd971fbe46f68d6f0e90b9..7a8ff6175658ed377ee4bc2a9ea08030f96a8834 100644 --- a/tests/test_gifti.py +++ b/tests/test_gifti.py @@ -224,6 +224,7 @@ def test_relatedFiles(): assert len(gifti.relatedFiles(badname)) == 0 assert len(gifti.relatedFiles('nonexistent')) == 0 + llisting = [op.join(td, f) for f in listing] lsurfaces = [op.join(td, f) for f in lsurfaces] rsurfaces = [op.join(td, f) for f in rsurfaces] lrelated = [op.join(td, f) for f in lrelated] @@ -236,6 +237,12 @@ def test_relatedFiles(): result = gifti.relatedFiles(s) assert sorted(rrelated) == sorted(result) + exp = lsurfaces + lrelated + exp = [f for f in exp if f != lsurfaces[0]] + result = gifti.relatedFiles(lsurfaces[0], + ftypes=gifti.ALLOWED_EXTENSIONS) + assert sorted(exp) == sorted(result) + TEST_VERTS = np.array([ [0, 0, 0], [1, 0, 0],