diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cbec212701b30903cf81d63e499ec97c7a098ffe..8407a74939c4934079eb04022caeb85a1d307ea6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -173,6 +173,12 @@ test:3.8: <<: *test_template +test:3.9: + stage: test + image: pauldmccarthy/fsleyes-py39-wxpy4-gtk3 + <<: *test_template + + test:build-pypi-dist: stage: test image: pauldmccarthy/fsleyes-py36-wxpy4-gtk3 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4dc7df9ec8ce20b7304ddc0b63307daa567e5018..f8fcd312c170a4eb392ab073b3abb21e8feed939 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,29 @@ This document contains the ``fslpy`` release history in reverse chronological order. +3.5.0 (Tuesday 19th January 2021) +--------------------------------- + + +Added +^^^^^ + + +* New ``fsl_anat.tree``, for use with the :mod:`.filetree` package (!264). +* New :func:`.fsl_prepare_fieldmap` wrapper function (!265). +* The :class:`.fslmaths` wrapper now supports the ``fslmaths -s`` option + via the :meth:`.fslmaths.smooth` method (!271). + + +Fixed +^^^^^ + + +* Windows/WSL-specific workaround to the :func:`fsl.utils.run.run` function to + avoid console windows from popping up, when used from a graphical program + (!272). + + 3.4.0 (Tuesday 20th October 2020) --------------------------------- diff --git a/COPYRIGHT b/COPYRIGHT index 2b9a3c28bd9d162848efdb59e6ce0ea744c83a85..ca6e317895149e49a34705663c4c40bbc2277cec 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1 +1 @@ -Copyright 2016-2020 University of Oxford, Oxford, UK +Copyright 2016-2021 University of Oxford, Oxford, UK diff --git a/LICENSE b/LICENSE index 611fcba5618c84542bbea51bb0329fd035ff3724..29dca5745c25932d5ed83f120fce41be0c17340f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The fslpy library -Copyright 2016-2020 University of Oxford, Oxford, UK. +Copyright 2016-2021 University of Oxford, Oxford, UK. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.rst b/README.rst index 797b5345ba2bce7dc0b6964649bf6e0d45ff48de..f8b8fd8a118d8b0ee4e3070735c2d56b6d3e7b56 100644 --- a/README.rst +++ b/README.rst @@ -19,7 +19,7 @@ programming library written in Python. It is used by `FSLeyes <https://git.fmrib.ox.ac.uk/fsl/fsleyes/fsleyes/>`_. -``fslpy`` is tested against Python versions 3.5, 3.6 and 3.7. +``fslpy`` is tested against Python versions 3.6, 3.7, 3.8 and 3.9. Installation diff --git a/fsl/utils/run.py b/fsl/utils/run.py index cf75fc505ce80e7db8046133970061fdca4ead90..1e535c8a336de44f3a7d819f067417075eaa16d3 100644 --- a/fsl/utils/run.py +++ b/fsl/utils/run.py @@ -286,6 +286,12 @@ def _realrun(tee, logStdout, logStderr, logCmd, *args, **kwargs): - the command's standard error as a string. - the command's exit code. """ + if fslplatform.fslwsl: + # On Windows this prevents opening of a popup window + startupinfo = sp.STARTUPINFO() + startupinfo.dwFlags |= sp.STARTF_USESHOWWINDOW + kwargs["startupinfo"] = startupinfo + proc = sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE, **kwargs) with tempdir.tempdir(changeto=False) as td: @@ -403,7 +409,7 @@ def wslcmd(cmdpath, *args): # Check if command exists in WSL (remembering that the command path may include FSLDIR which # is a Windows path) cmdpath = fslpath.wslpath(cmdpath) - retcode = sp.call(["wsl", "test", "-x", cmdpath]) + _stdout, _stderr, retcode = _realrun(False, None, None, None, "wsl", "test", "-x", cmdpath) if retcode == 0: # Form a new argument list and convert any Windows paths in it into WSL paths wslargs = [fslpath.wslpath(arg) for arg in args] diff --git a/fsl/version.py b/fsl/version.py index d15f2d69b6baff5ebd4e06679be3bd27b9deaf96..d094aa68f0e67876293c40f359127f5ea32c5995 100644 --- a/fsl/version.py +++ b/fsl/version.py @@ -47,7 +47,7 @@ import re import string -__version__ = '3.5.0.dev0' +__version__ = '3.6.0.dev0' """Current version number, as a string. """ diff --git a/tests/test_dicom.py b/tests/test_dicom.py index e3b444c3c6c535416c86c7a690b5e4e37d2c8d9e..dba678f4868368b514968263f362dafa2759192f 100644 --- a/tests/test_dicom.py +++ b/tests/test_dicom.py @@ -29,10 +29,10 @@ pytestmark = pytest.mark.dicomtest @contextlib.contextmanager -def install_dcm2niix(version='1.0.20190902'): +def install_dcm2niix(version='1.0.20201102'): filenames = { + '1.0.20201102' : 'v1.0.20201102/dcm2niix_lnx.zip', '1.0.20190902' : 'v1.0.20190902/dcm2niix_lnx.zip', - '1.0.20190410' : 'v1.0.20190410/dcm2niix_11-Apr-2019_lnx.zip', '1.0.20181125' : 'v1.0.20181125/dcm2niix_25-Nov-2018_lnx.zip', '1.0.20171017' : 'v1.0.20171017/dcm2niix_18-Oct-2017_lnx.zip', } @@ -128,8 +128,9 @@ def test_scanDir(): assert len(series) == 2 for s in series: - assert (s['PatientName'] == 'MCCARTHY_PAUL' or - s['PatientName'] == 'MCCARTHY_PAUL_2') + assert s['PatientName'] in ('MCCARTHY_PAUL', + 'MCCARTHY^PAUL', + 'MCCARTHY_PAUL_2') def test_sersiesCRC(): @@ -158,7 +159,7 @@ def test_sersiesCRC(): def test_loadSeries(): # test a pre-CRC and a post-CRC version - for version in ('1.0.20190410', '1.0.20190902'): + for version in ('1.0.20181125', '1.0.20201102'): with install_dcm2niix(version): @@ -170,23 +171,23 @@ def test_loadSeries(): dcmdir = os.getcwd() series = fsldcm.scanDir(dcmdir) expShape = (512, 512, 1) - explens = [1, 1] - for s, explen in zip(series, explens): + for s in series: imgs = fsldcm.loadSeries(s) - assert len(imgs) == explen - for img in imgs: assert img.dicomDir == dcmdir assert img.shape == expShape assert img[:].shape == expShape - assert img.getMeta('PatientName') == 'MCCARTHY_PAUL' or \ - img.getMeta('PatientName') == 'MCCARTHY_PAUL_2' + assert img.getMeta('PatientName') in ('MCCARTHY_PAUL', + 'MCCARTHY^PAUL', + 'MCCARTHY_PAUL_2') assert 'PatientName' in img.metaKeys() assert 'MCCARTHY_PAUL' in img.metaValues() or \ + 'MCCARTHY^PAUL' in img.metaValues() or \ 'MCCARTHY_PAUL_2' in img.metaValues() assert ('PatientName', 'MCCARTHY_PAUL') in img.metaItems() or \ + ('PatientName', 'MCCARTHY^PAUL') in img.metaItems() or \ ('PatientName', 'MCCARTHY_PAUL_2') in img.metaItems()