Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • paulmc/fslpy
  • ndcn0236/fslpy
  • seanf/fslpy
3 results
Show changes
Commits on Source (958)
......@@ -2,6 +2,6 @@
set -e
pip install -r requirements-dev.txt
python setup.py doc
mv doc/html doc/"$CI_COMMIT_REF_NAME"
source /test.venv/bin/activate
pip install ".[doc]"
sphinx-build doc public
......@@ -2,28 +2,15 @@
set -e
pip install wheel setuptools twine
python setup.py sdist
python setup.py bdist_wheel
pip install --upgrade pip wheel setuptools twine build
python -m build
twine check dist/*
# do a test install from both source and wheel
sdist=`find dist -maxdepth 1 -name *.tar.gz`
wheel=`find dist -maxdepth 1 -name *.whl`
# pip < 10 will not install wheels
# with an invalid name. So we can
# generate builds from non-releases
# (e.g. master master branch),
# we hack the wheel file name here
# so that pip will accept it.
#
# This will no longer be necessary
# when pip 10 is available.
nwheel=`echo -n $wheel | sed -e 's/fslpy-/fslpy-0/g'`
mv $wheel $nwheel
wheel=$nwheel
for target in $sdist $wheel; do
python -m venv test.venv
. test.venv/bin/activate
......
#!/usr/bin/env bash
set -e
rsync -rv doc/"$CI_COMMIT_REF_NAME" "docdeploy:"
......@@ -43,37 +43,17 @@ if [[ -f /.dockerenv ]]; then
eval $(ssh-agent -s);
mkdir -p $HOME/.ssh;
echo "$SSH_PRIVATE_KEY_GIT" > $HOME/.ssh/id_git;
# for downloading FSL atlases/standards
echo "$SSH_PRIVATE_KEY_FSL_DOWNLOAD" > $HOME/.ssh/id_fsl_download;
if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then
echo "$SSH_PRIVATE_KEY_DOC_DEPLOY" > $HOME/.ssh/id_doc_deploy;
fi;
chmod go-rwx $HOME/.ssh/id_*;
ssh-add $HOME/.ssh/id_git;
ssh-add $HOME/.ssh/id_fsl_download;
if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then
ssh-add $HOME/.ssh/id_doc_deploy;
fi
ssh-keyscan ${UPSTREAM_URL##*@} >> $HOME/.ssh/known_hosts;
ssh-keyscan ${DOC_HOST##*@} >> $HOME/.ssh/known_hosts;
ssh-keyscan ${FSL_HOST##*@} >> $HOME/.ssh/known_hosts;
ssh-keyscan ${FSL_HOST##*@} >> $HOME/.ssh/known_hosts;
touch $HOME/.ssh/config;
echo "Host ${UPSTREAM_URL##*@}" >> $HOME/.ssh/config;
echo " User ${UPSTREAM_URL%@*}" >> $HOME/.ssh/config;
echo " IdentityFile $HOME/.ssh/id_git" >> $HOME/.ssh/config;
echo "Host docdeploy" >> $HOME/.ssh/config;
echo " HostName ${DOC_HOST##*@}" >> $HOME/.ssh/config;
echo " User ${DOC_HOST%@*}" >> $HOME/.ssh/config;
echo " IdentityFile $HOME/.ssh/id_doc_deploy" >> $HOME/.ssh/config;
echo "Host fsldownload" >> $HOME/.ssh/config;
echo " HostName ${FSL_HOST##*@}" >> $HOME/.ssh/config;
echo " User ${FSL_HOST%@*}" >> $HOME/.ssh/config;
......
......@@ -2,27 +2,14 @@
set -e
# If running on a fork repository, we merge in the
# upstream/master branch. This is done so that merge
# requests from fork to the parent repository will
# have unit tests run on the merged code, something
# which gitlab CE does not currently do for us.
if [[ "$CI_PROJECT_PATH" != "$UPSTREAM_PROJECT" ]]; then
git fetch upstream;
git merge --no-commit --no-ff -s recursive -X ours upstream/master;
fi;
source /test.venv/bin/activate
pip install --retries 10 -r requirements.txt
pip install --retries 10 -r requirements-extra.txt
pip install --retries 10 -r requirements-dev.txt
pip install ".[extra,test,style]"
# style stage
if [ "$TEST_STYLE"x != "x" ]; then pip install --retries 10 pylint flake8; fi;
if [ "$TEST_STYLE"x != "x" ]; then flake8 fsl || true; fi;
if [ "$TEST_STYLE"x != "x" ]; then pylint --output-format=colorized fsl || true; fi;
if [ "$TEST_STYLE"x != "x" ]; then exit 0; fi
if [ "$TEST_STYLE"x != "x" ]; then exit 0; fi;
# We need the FSL atlases for the atlas
# tests, and need $FSLDIR to be defined
......@@ -30,15 +17,21 @@ export FSLDIR=/fsl/
mkdir -p $FSLDIR/data/
rsync -rv "fsldownload:$FSL_ATLAS_DIR" "$FSLDIR/data/atlases/"
# Finally, run the damned tests.
# Run the tests. Suppress coverage
# reporting until after we're finished.
TEST_OPTS="--cov-report= --cov-append"
# pytest struggles with my organisation of
# the fslpy package, where all tests are in
# fsl.tests, and fsl is a namespace package
touch fsl/__init__.py
# We run some tests under xvfb-run
# because they invoke wx. Sleep in
# between, otherwise xvfb gets upset.
xvfb-run -a python setup.py test --addopts="$TEST_OPTS tests/test_idle.py"
xvfb-run -a pytest $TEST_OPTS fsl/tests/test_idle.py
sleep 5
xvfb-run -a python setup.py test --addopts="$TEST_OPTS tests/test_platform.py"
xvfb-run -a pytest $TEST_OPTS fsl/tests/test_platform.py
# We run the immv/imcp tests as the nobody
# user because some tests expect permission
......@@ -47,16 +40,20 @@ xvfb-run -a python setup.py test --addopts="$TEST_OPTS tests/test_platform.py"
# this directory writable by anybody (which,
# unintuitively, includes nobody)
chmod -R a+w `pwd`
cmd="source /test.venv/bin/activate && python setup.py test"
cmd="$cmd --addopts='$TEST_OPTS tests/test_scripts/test_immv_imcp.py tests/test_immv_imcp.py'"
cmd="source /test.venv/bin/activate && pytest"
cmd="$cmd $TEST_OPTS fsl/tests/test_scripts/test_immv_imcp.py fsl/tests/test_immv_imcp.py"
su -s /bin/bash -c "$cmd" nobody
# All other tests can be run as normal.
python setup.py test --addopts="$TEST_OPTS -m 'not longtest' --ignore=tests/test_idle.py --ignore=tests/test_platform.py --ignore=tests/test_immv_imcp.py --ignore=tests/test_scripts/test_immv_imcp.py"
pytest $TEST_OPTS -m 'not longtest' \
--ignore=fsl/tests/test_idle.py \
--ignore=fsl/tests/test_platform.py \
--ignore=fsl/tests/test_immv_imcp.py \
--ignore=fsl/tests/test_scripts/test_immv_imcp.py
# Long tests are only run on release branches
if [[ $CI_COMMIT_REF_NAME == v* ]]; then
python setup.py test --addopts="$TEST_OPTS -m 'longtest'"
pytest $TEST_OPTS -m 'longtest'
fi
python -m coverage report
python -m coverage report -i
......@@ -9,10 +9,14 @@ zenodo_url=$1
zenodo_tkn=$2
zenodo_depid=$3
version=`python setup.py -V`
upfile=`pwd`/dist/fslpy-"$version".tar.gz
metafile=`pwd`/.ci/zenodo_meta.json.jinja2
date=`date +"%Y-%m-%d"`
version=$(cat fsl/version.py |
egrep '^__version__ +=' |
cut -d "=" -f 2 |
tr -d "'" |
tr -d ' ')
upfile=$(pwd)/dist/fslpy-"$version".tar.gz
metafile=$(pwd)/.ci/zenodo_meta.json.jinja2
date=$(date +"%Y-%m-%d")
pip install --retries 10 requests jinja2
......
......@@ -9,12 +9,12 @@
#
# 2. style: Check coding style
#
# 3. doc: Building API documentation
# 3. doc: Building and upload API documentation using GitLab Pages.
#
# 4. build: Building source and wheel distributions
#
# 5. deploy: Uploading the build outputs to pypi/hosting servers, and the
# documentation to a hosting server.
# 5. deploy: Uploading the build outputs to pypi/hosting servers.
#
#
# Custom docker images are used for several jobs - these images are
# available at:
......@@ -24,13 +24,10 @@
# The test and style stages are executed on all branches of upstream and fork
# repositories.
#
# The doc stage, and the deploy-doc job, is executed on all branches of the
# upstream repository.
#
# The build stage, and the remaining jobs in the deploy stage, are only
# executed on the upstream repository, and only for release tags.
# The doc stage is executed on release branches of the upstream repository.
#
# The deploy stages are manually instantiated.
# The build and deploy stages are executed on tags on the upstream
# repository, and the deploy stage must be manually instantiated.
#
# Most of the logic for each job is defined in shell scripts in the .ci
# sub-directory.
......@@ -61,16 +58,10 @@ stages:
# - SSH_PRIVATE_KEY_FSL_DOWNLOAD - private key for downloading some FSL
# files from a remote server (FSL_HOST)
#
# - SSH_PRIVATE_KEY_DOC_DEPLOY - private key for rsyncing documentation
# to remote host (DOC_HOST)
#
# - SSH_SERVER_HOSTKEYS - List of trusted SSH hosts
#
# - DOC_HOST: - Username@host to upload documentation to
# (e.g. "paulmc@jalapeno.fmrib.ox.ac.uk")
#
# - FSL_HOST: - Username@host to download FSL data from
# (e.g. "paulmc@jalapeno.fmrib.ox.ac.uk")
# (most likely "paulmc@localhost")
#
# - FSL_ATLAS_DIR: - Location of the FSL atlas data on
# FSL_HOST.
......@@ -100,14 +91,9 @@ variables:
####################################
.only_upstream: &only_upstream
.only_release_branches: &only_release_branches
only:
- branches@fsl/fslpy
.only_master: &only_master
only:
- master@fsl/fslpy
- /^v.+$/@fsl/fslpy
.only_releases: &only_releases
......@@ -115,11 +101,6 @@ variables:
- tags@fsl/fslpy
.except_releases: &except_releases
except:
- tags
.setup_ssh: &setup_ssh
before_script:
- bash ./.ci/setup_ssh.sh
......@@ -142,13 +123,31 @@ variables:
# Test stage
############
.test_rules: &test_rules
# We only run tests on MRs, and on release branches
# (a more substantial test suite is run on release
# branches - see .ci/test_template.sh). We don't run
# on upstream/main, as all merges are fast-forwards,
# so the tests will have already been run on the MR
# branch. We also allow manually running a pipeline
# via the web interface.
rules:
- if: $SKIP_TESTS != null
when: never
- if: $CI_COMMIT_MESSAGE =~ /\[skip-tests\]/
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: on_success
- if: $CI_PROJECT_PATH == $UPSTREAM_PROJECT && $CI_COMMIT_BRANCH =~ /^v.+$/
when: on_success
- if: $CI_PIPELINE_SOURCE == "web"
when: on_success
- when: never
.test: &test_template
<<: *setup_ssh
# Releases are just tags on a release
# branch, so we don't need to test them.
<<: *except_releases
<<: *test_rules
tags:
- docker
......@@ -157,34 +156,39 @@ variables:
- bash ./.ci/test_template.sh
test:3.6:
test:3.10:
stage: test
image: pauldmccarthy/fsleyes-py310-wxpy4-gtk3
<<: *test_template
test:3.11:
stage: test
image: pauldmccarthy/fsleyes-py36-wxpy4-gtk3
image: pauldmccarthy/fsleyes-py311-wxpy4-gtk3
<<: *test_template
test:3.7:
test:3.12:
stage: test
image: pauldmccarthy/fsleyes-py37-wxpy4-gtk3
image: pauldmccarthy/fsleyes-py312-wxpy4-gtk3
<<: *test_template
test:3.8:
test:3.13:
stage: test
image: pauldmccarthy/fsleyes-py38-wxpy4-gtk3
image: pauldmccarthy/fsleyes-py313-wxpy4-gtk3
<<: *test_template
test:build-pypi-dist:
stage: test
image: pauldmccarthy/fsleyes-py36-wxpy4-gtk3
<<: *except_releases
image: python:3.10
<<: *test_rules
tags:
- docker
script:
- source /test.venv/bin/activate
- bash ./.ci/build_pypi_dist.sh
......@@ -195,32 +199,37 @@ test:build-pypi-dist:
style:
stage: style
image: pauldmccarthy/fsleyes-py36-wxpy4-gtk3
image: pauldmccarthy/fsleyes-py310-wxpy4-gtk3
<<: *test_template
variables:
TEST_STYLE: "true"
###########
# Doc stage
###########
#############
# Pages stage
#############
# I would like to have separate doc deploys for
# both the main and latest release branches,
# but this is awkward with gitlab pages. So
# currently the most recently executed pages
# job is the one that gets deployed.
build-doc:
<<: *only_upstream
pages:
<<: *only_release_branches
tags:
- docker
stage: doc
image: python:3.6
image: pauldmccarthy/fsleyes-py310-wxpy4-gtk3
script:
- bash ./.ci/build_doc.sh
artifacts:
expire_in: 1 day
paths:
- doc/$CI_COMMIT_REF_NAME
- public
#############
......@@ -233,7 +242,7 @@ build-pypi-dist:
<<: *check_version
stage: build
image: python:3.6
image: python:3.10
tags:
- docker
......@@ -252,29 +261,12 @@ build-pypi-dist:
##############
deploy-doc:
<<: *only_upstream
<<: *setup_ssh
stage: deploy
when: manual
image: python:3.6
tags:
- docker
dependencies:
- build-doc
script:
- bash ./.ci/deploy_doc.sh
deploy-pypi:
<<: *only_releases
<<: *setup_ssh
stage: deploy
when: manual
image: python:3.6
image: python:3.10
tags:
- docker
......@@ -291,7 +283,7 @@ deploy-zenodo:
<<: *setup_ssh
stage: deploy
when: manual
image: python:3.6
image: python:3.10
tags:
- docker
......
......@@ -3,4 +3,7 @@ Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Matthew Webster <matthew.webster@ndcn.ox.ac.uk>
Sean Fitzgibbon <sean.fitzgibbon@ndcn.ox.ac.uk>
Martin Craig <martin.craig@eng.ox.ac.uk>
Taylor Hanayik <taylor.hanayik@ndcn.ox.ac.uk>
\ No newline at end of file
Taylor Hanayik <taylor.hanayik@ndcn.ox.ac.uk>
Evan Edmond <evan.edmond@ndcn.ox.ac.uk>
Christoph Arthofer <christoph.arthofer@ndcn.oxc.ac.uk>
Fidel Alfaro Almagro <fidel.alfaroalmagro@ndcn.ox.ac.uk>
\ No newline at end of file
This document contains the ``fslpy`` release history in reverse chronological
order.
XXX (Under development)
-----------------------
Fixed
^^^^^
* Adjusted the :func:`.featdesign.loadFEATDesignFile` function to handle missing
values (!469).
* Fix to the :class:`.Notifier` class involving handling of callback functions
that have been garbage-collected (!470).
3.22.0 (Monday 17th February 2025)
----------------------------------
Changed
^^^^^^^
* The :meth:`.Nifti.getAffine` method now supports the ``'scaled'`` coordinate
system, which is equivalent to the ``'fsl'`` coordinate system, but without
any flip along the first axis (!466).
Deprecated
^^^^^^^^^^
* Deprecated the :meth:`.Nifti.voxToScaledVoxMat` and
:meth:`.Nifti.caledVoxToVoxMat` properties in favour of using the
:meth:`.Nifti.getAffine` method (!466).
3.21.1 (Friday 27th September 2024)
-----------------------------------
Changed
^^^^^^^
* The :func:`.fixlabels.loadLabelFile` and :func:`.fixlabels.saveLabelFile`
functions now support FIX label files which contain classification
probabilities, as generated by pyfix >= 0.9.0, and old FIX >= 1.069 (!464).
3.21.0 (Tuesday 23rd July 2024)
-------------------------------
Changed
^^^^^^^
* Behaviour of the ``imcp`` / ``immv`` commands has been adjusted so that
when an image file is copied/moved, and converted to a different format
(e.g. ``.nii`` to ``.nii.gz``), the image data and header slope/intercept
fields are not modified (!462).
3.20.0 (Wednesday 10th July 2024)
---------------------------------
Added
^^^^^
* New functions/methods in the :mod:`.featanalysis` module and
:class:`.FEATImage` class for accessing F-test results (!460).
3.19.1 (Wednesday 26th June 2024)
---------------------------------
Fixed
^^^^^
* Minor Updates for compatibility with ``numpy`` 2.0 (!458).
3.19.0 (Friday 24th May 2024)
-----------------------------
Added
^^^^^
* New :func:`.bedpostx` and :func:`.bedpostx_gpu` wrapper functions (!455).
* New :meth:`.Platform.wsl` property for detecting whether we are running
under Microsoft WSL (!456).
Deprecated
^^^^^^^^^^
* Deprecated the :func:`.bedpostx_postproc_gpu` wrapper function - the
``bedpostx_postproc_gpu.sh`` and ``bedpostx_postproc.sh`` scripts are not
intended to be called directly (!455).
3.18.3 (Saturday 4th May 2024)
------------------------------
Fixed
^^^^^
* Fixed an issue with :mod:``fsl.wrappers`` functions not finding output files
when ``$FSLOUTPUTTYPE`` is set to something other than ``NIFTI_GZ`` (!452).
3.18.2 (Wednesday 3rd April 2024)
---------------------------------
Fixed
^^^^^
* Made some changes to the :mod:`fsl.utils.run` module to improve
compatibility with [`dill`](https://github.com/uqfoundation/dill/) (!449).
3.18.1 (Tuesday 5th March 2024)
-------------------------------
Fixed
^^^^^
* Fixed an issue which could cause :mod:`fsl.wrappers` functions to crash
when being executed concurrently (!446).
3.18.0 (Thursdday 22nd February 2024)
-------------------------------------
Added
^^^^^
* New wrapper function for the FLIRT `midtrans` command (!443).
* The :class:`.Image` class now accepts a ``version`` parameter, as an
easy way of specifying the NIfTI file format version (!443).
3.17.0 (Friday 9th February 2024)
---------------------------------
Added
^^^^^
* New wrapper function for the FLIRT `makerot` command (!441).
* New wrapper functions for the `imcp`, `immv`, `imrm`, `imln`, `imglob` and
`imtest` commands. These are all implemented within fslpy, so the wrapper
functions invoke them directly (i.e. within the same process) (!441).
3.16.1 (Wednesday 17th January 2024)
------------------------------------
Added
^^^^^
* The :func:`run` function now allows the ``log{'stdout']`` and
``log{'stderr'}`` options (used for capturing the standard output/error
streams of a called process) to be either file-likes or callables (!438).
3.16.0 (Thursday 21st December 2023)
------------------------------------
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)
----------------------------------
Added
^^^^^
* New `silent` option to the :func:`.run` function = passing ``silent=True`` is
equivalent to passing ``log={'tee':False}`` (!428).
* New `prefix` option to the :func:`.tempdir` function, which is passed through
to ``tempfile.mkdtemp`` (!429).
3.15.3 (Thursday 16th November 2023)
------------------------------------
Changed
^^^^^^^
* Adjusted the :func:`.loadLabelFile` function to accept files with missing
entries, and files which only contain the MELODIC directory path and list of
noisy components (!424, !425).
Fixed
^^^^^
* Fixed a bug in the :func:`.run.hold` function (!426).
3.15.2 (Wednesday 4th October 2023)
-----------------------------------
Fixed
^^^^^
* Removed the obsolete :func:`fsl.wrappers.misc.cluster` wrapper function
(!422).
3.15.1 (Monday 25th September 2023)
-----------------------------------
Fixed
^^^^^
* Fixed a problem with some unit tests (!420).
3.15.0 (Monday 25th September 2023)
-----------------------------------
Added
^^^^^
* New :func:`.cluster` wrapper function for the FSL ``cluster`` /
``fsl-cluster`` command (!417).
Changed
^^^^^^^
* All metadata stored in GIfTI files is now copied by :class:`.GiftiMesh`
instances into their :class:`.Meta` store (!416).
3.14.1 (Thursday 31st August 2023)
----------------------------------
Fixed
^^^^^
* Fixed a bug in :meth:`.Image.__setitem__` - change listeners were being
passed an un-normalised ``slice`` object (with slices for trailing
dimensions of length 1 present) (!414).
3.14.0 (Wednesday 30th August 2023)
-----------------------------------
Added
^^^^^
* New :func:`.affine.flip` function, for applying a flip/inversion to the
axes of an affine transformation (!403).
Changed
^^^^^^^
* The ``sform``/``qform`` fields of a :class:`.DeformationField` instance are
automatically set from the reference image if they are not already set (!402).
* Replaced ``setup.py``-based build system with ``pyproject.toml`` (!402).
* Tests have been moved into the ``fsl/tests/`` package (!402).
* Updated the ```immv``/``imcp`` scripts to support ``FSLOUTPUTTYPE=ANALYZE``
(!405).
Fixed
^^^^^
* Updated the ```immv``/``imcp`` scripts to honour the ``$FSLOUTPUTTYPE``
environment variable more closely - conversions between NIFTI1 and
NIFTI2 were not being performed correctly (!405).
3.13.3 (Monday 17th July 2023)
------------------------------
Changed
^^^^^^^
* Callback functions registered with :class:`.Notifier` instances no longer
need to accept three arguments (!400).
3.13.2 (Monday 3rd July 2023)
-----------------------------
Added
^^^^^
* New ``scaleAtOrigin`` option to the :func:`.affine.compose` function, which
allows the origin to be preserved by scaling parameters (!398).
3.13.1 (Tuesday 13th June 2023)
-------------------------------
Fixed
^^^^^
* Fixed some minor issues with API documentation (!396).
3.13.0 (Monday 12th June 2023)
------------------------------
Added
^^^^^
* New :func:`.runfunc` function which can be used to execute a Python function
in a separate process (or as a submitted cluster job), via the
:func:`~fsl.utils.run.func_to_cmd` function (!390).
* New ``keys()``, ``values()``, and ``items()`` methods on the :class:`.Cache`
class (!391).
Changed
^^^^^^^
* The :func:`.run.func_to_cmd`, :func:`.run.hold`, and :func:`.run.job_output`
functions have been moved from :mod:`fsl.utils.fslsub` to the
:mod:`fsl.utils.run` module (!390).
Deprecated
^^^^^^^^^^
* The :mod:`fsl.utils.fslsub` module has been deprecated, and scheduled for
removal in ``fslpy 4.0.0`` (!390).
3.12.1 (Tuesday 23rd May 2023)
------------------------------
Fixed
^^^^^
* The :mod:`fsl.scripts.Text2Vest` now handles column vector inputs
correctly (!387, !388).
* The :func:`.tempdir` function was not changing back to the original
working directory when the ``override`` argument was used (!388).
3.12.0 (Friday 19th May 2023)
-----------------------------
Added
^^^^^
* New :func:`.randomise` wrapper function.
Changed
^^^^^^^
* The :func:`.fslmaths` wrapper function now allows the ``-dt`` and
``-odt`` options to be set (!381).
* Assertions (from the :mod:`.assertions` module) called within wrapper
functions are now disabled if the command is to be submitted via
``fsl_sub`` (!382).
* The :class:`.Image` class will now resolve symlinks when loading images
from file (!383).
Fixed
^^^^^
* The :func:`.fslstats` wrapper no longer overwrites the ``log`` option that
is passed to :func:`~.run.run`, if a :func:`.wrapperconfig` context is
active (!381).
3.11.3 (Thursday 2nd March 2023)
--------------------------------
Fixed
^^^^^
* Fixed another bug in the :func:`.dcm2niix` function (!379).
3.11.2 (Monday 27th February 2023)
----------------------------------
Fixed
^^^^^
* Fixed a bug in the :func:`.dcm2niix` function (!376).
* Adjusted the :mod:`.imrm` and :mod:`.imglob` scripts to support incomplete
wildcard patterns (e.g. ``img_??`` matching ``img_01.nii.gz``) (!377).
3.11.1 (Friday 24th February 2023)
----------------------------------
Added
^^^^^
* New :func:`.featquery` wrapper function (!374).
Fixed
^^^^^
* fixed the :class:`.fslstats` wrapper to handle index masks (the ``-K``
option) with missing label values (!374).
3.11.0 (Monday 20th February 2023)
----------------------------------
Added
^^^^^
* New :func:`.standard_space_roi`, :func:`.fslswapdim`, :func:`.fslmerge`,
:func:`.fslsplit`, :func:`fslselectvols`, and :func:`.fslcpgeom` wrapper
functions (!351, !354, !364).
* New :mod:`fsl.wrappers.first` wrapper functions (!355).
* New :mod:`fsl.wrappers.bianca` and :mod:`fsl.wrappers.avwutils` wrapper
functions (!358).
* New :mod:`fsl.wrappers.bedpostx` and :mod:`~.wrappers.dtifit` wrapper
functions (!364).
* New :func:`~fsl.wrappers.feat.feat`, :func:`~.melodic.fsl_regfilt` and
:func:`~.melodic.fsl_glm` wrapper functions (!364).
* New :func:`.oxford_asl` and :func:`asl_file` wrapper functions (!368).
* New :func:`.wrapperconfig` context manager function, which allows the
default values for arguments passed by the :mod:`fsl.wrappers` functions to
the :func:`fsl.utils.run.run` function to be changed (!352, !356).
* New :func:`.affine.mergeBounds` function (!360).
Changed
^^^^^^^
* The :class:`fsl.wrappers.fslmaths.fslmaths` and
:class:`fsl.wrappers.fslstats.fslstats` wrapper functions have been updated
to accept arguments destined for :func:`fsl.utils.run.run` (!352).
* :class:`.Mesh` objects can now be created without indices/triangles - they
can be assigned after creation (!360).
* The :mod:`.dicom` module will now preferentially call
``$FSLDIR/bin/dcm2niix``, instead of calling the first ``dcm2niix`` on the
``$PATH`` (!365).
* The :func:`.applyArgStyle` ``argmap`` argument can now be a callable which
defines a rule which will be applied to all argument names (!366).
* The :func:`.applyArgStyle` ``valmap`` argument now accepts a new
``EXPAND_LIST`` option, which allows sequences to be expanded as separate
command-line options (!366).
* :class:`.Image` objects can now be created without passing a
``nibabel.Nifti1Image`` (or similar) object, as long as a
``nibabel.Nifti1Header`` and a :class:`.DataManager` are provided (!362).
Fixed
^^^^^
* Fixed a bug in the :meth:`.Image.strval` method (!353).
3.10.0 (Wednesday 29th June 2022)
---------------------------------
Added
^^^^^
* New :func:`fsl.wrappers.eddy.eddy` function, to replace :func:`.eddy_cuda`.
Note that this function will not work with FSL versions 6.0.5.2 or older
(!348).
Deprecated
^^^^^^^^^^
* The :func:`fsl.wrappers.eddy.eddy_cuda` function has been deprecated in
favour of the ``eddy`` function (!348).
3.9.6 (Wednesday 15th June 2022)
--------------------------------
Added
^^^^^
* The `.fslmaths` wrapper now supports the ``-roi`` option, via the
:meth:`.fslmaths.roi` method (!346).
3.9.5 (Thursday 2nd June 2022)
------------------------------
Changed
^^^^^^^
* Updated the :func:`.ensureIsImage` function to support ``pathlib.Path``
objects (!343).
Fixed
^^^^^
* Some fixes in the :mod:`.wrappers` module (specifically in the
:class:`.FileOrThing` class) to better support ``pathlib.Path`` objects
(!343).
3.9.4 (Friday 27th May 2022)
----------------------------
Changed
^^^^^^^
* Changed the behaviour of :meth:`.Image.__getitem__` so that, if image
data is accessed with a boolean mask array (e.g. ``image[mask > 0]``),
the image data is loaded into memory (!341).
3.9.3 (Friday 27th May 2022)
----------------------------
Fixed
^^^^^
* Fixed an issue in the :func:`~.fslsub.func_to_cmd` function (!339).
3.9.2 (Friday 20th May 2022)
----------------------------
Changed
^^^^^^^
* Added the :data:`.NIFTI_XFORM_TEMPLATE_OTHER` identifier, an extension to the
NIfTI standard (!337).
3.9.1 (Friday 13th May 2022)
----------------------------
Changed
^^^^^^^
* Adjusted the :func:`.applyArgStyle` function so that it allows separate
specification of the style to use for single-character arguments. This
fixes some usage issues with commands such as FSL ``fast``, which have
regular ``--=`` arguments, but also single-character arguments which
expect multiple positional values (!335).
3.9.0 (Tuesday 12th April 2022)
-------------------------------
Added
^^^^^
* New :meth:`.Image.niftiDataTypeSize` method, which reports the number
of bits per voxel, according to the NIfTI data type (!327).
Changed
^^^^^^^
* The :class:`.Image` class no longer uses an :class:`.ImageWrapper` to
manage data access and assignment (!327).
* Semantics for accessing and modifying image data have changed. By default,
image data access is now delegated to the underlying ``nibabel.Nifti1Image``
object (and so remains on disk by default). Image data can be loaded into
memory by accessing the :meth:`.Image.data` property, or by modifying the
data through :meth:`.Image.__setitem__` (!327).
* The :func:`~.fslsub.func_to_cmd` function now uses `dill
<https://dill.readthedocs.io/en/latest/>`_ instead of ``pickle`` for
serialisation (!328).
Fixed
^^^^^
* Fixes to the :mod:`.melodic` and :meth:`.eddy` wrapper functions.
Deprecated
^^^^^^^^^^
* The :mod:`.imagewrapper` module (and the :class:`.ImageWrapper` class) is
being migrated to FSLeyes (!327).
* The ``loadData``, ``calcRange``, and ``threaded`` arguments to the
:class:`.Image` class are deprecated and no longer have any effect (!327).
* The :meth:`.Nifti.mapIndices` method is deprecated (!327).
* The :meth:`.Image.getImageWrapper`, :meth:`.Image.calcRange` and
:meth:`.Image.loadData` methods are deprecated and no longer have any effect
(!327).
3.8.2 (Tuesday 15th February 2022)
----------------------------------
Fixed
^^^^^
* The the :func:`.topup` wrapper function now allows multiple file names to
be passed to the ``--imain`` argument (!324).
3.8.1 (Tuesday 28th December 2021)
----------------------------------
Fixed
^^^^^
* The :func:`.melodic` wrapper function no longer requires its ``input``
argument to be a NIFTI image or file (!321).
3.8.0 (Thursday 23rd December 2021)
-----------------------------------
Added
^^^^^
* New :func:`.fslorient` wrapper function (!315).
* The :class:`.Bitmap` class has basic support for loading JPEG2000 images
(!316).
Fixed
^^^^^
* Fixed an issue with API documentation generation (!317).
3.7.1 (Friday 12th November 2021)
---------------------------------
Changed
^^^^^^^
* BIDS and ``dcm2niix`` ``.json`` sidecar files with control characters
are now accepted (!312).
Fixed
^^^^^
* Fixed an issue with temporary input files created by :mod:`fsl.wrappers`
functions not being deleted (!313).
3.7.0 (Friday 20th August 2021)
-------------------------------
Added
^^^^^
* New :mod:`fsl.wrappers.fsl_sub` wrapper function for the ``fsl_sub``
command (!309).
Changed
^^^^^^^
* Performance of the :mod:`.imglob`, :mod:`.imln`, :mod:`imtest`, :mod:`.imrm`
and :mod:`.remove_ext` scripts has been improved, by re-organising them to
avoid unnecessary and expensive imports such as ``numpy`` (!310).
* The default behaviour of the :func:`fsl.utils.run.run` function (and hence
that of all :mod:`fsl.wrappers` functions) has been changed so that the
standard output and error of the called command is now forwarded to the
calling Python process, in addition to being returned from ``run`` as
strings. In other words, the default behaviour of ``run('cmd')``, is now
equivalent to ``run('cmd', log={"tee":True})``. The previous default
behaviour can be achieved with ``run('cmd', log={"tee":False})`` (!309).
* The :func:`fsl.utils.run.run` and :func:`fsl.utils.run.runfsl` functions
(and hence all :mod:`fsl.wrappers` functions) have been modified to use
``fsl.wrappers.fsl_sub`` instead of ``fsl.utils.fslsub.submit``. This is an
internal change which should not affect the usage of the ``run``, ``runfsl``
or wrapper functions (!309).
Deprecated
^^^^^^^^^^
* :class:`fsl.utils.fslsub.SubmitParams` and :func:`fsl.utils.fslsub.submit`
have been deprecated in favour of using the ``fsl.wrappers.fsl_sub`` wrapper
function (!309).
* The :func:`fsl.utils.fslsub.info` function has been deprecated in favour of
using the ``fsl_sub.report`` function, from the separate `fsl_sub
<https://git.fmrib.ox.ac.uk/fsl/fsl_sub>`_ Python library (!309).
3.6.4 (Tuesday 3rd August 2021)
-------------------------------
Added
^^^^^
* New :func:`.epi_reg` wrapper function (!306).
* New :meth:`.fslmaths.kernel` and :meth:`.fslmaths.fmeanu` options on the
:class:`.fslmaths` wrapper (!304).
3.6.3 (Wednesday 28th July 2021)
--------------------------------
Changed
^^^^^^^
* When creating an ``Image`` object with ``loadData=False``, the ``calcRange``
argument is ignored, as it would otherwise cause the data to be loaded
(!301).
3.6.2 (Wednesday 23rd June 2021)
--------------------------------
Changed
^^^^^^^
* The ``fsl.wrappers.fast`` wrapper passes ``-v`` to ``fast`` if ``v=True`` or
``verbose=True`` is specified.
3.6.1 (Thursday 27th May 2021)
------------------------------
Changed
^^^^^^^
* Removed the ``dataclasses`` backport from requirements (!297).
3.6.0 (Monday 19th April 2021)
------------------------------
Changed
^^^^^^^
* The ``fslpy`` API ocumentation is now hosted at
https://open.win.ox.ac.uk/pages/fsl/fslpy (!290).
* The :mod:`fsl` and :mod:`fsl.scripts` packages have been changed from being
`pkgutil-style
<https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages>`_
namespace packages to now being `native
<https://packaging.python.org/guides/packaging-namespace-packages/#native-namespace-packages>`_
namespace packages (!290).
* The :class:`.TaskThread` now allows an error handler function to be
specified, which is run on the :mod:`.idle` loop (!283).
* The :func:`.bids.loadMetadata` function no long resolves sym-links when
determining whether a file is contained within a BIDS data set (!287).
* The :class:`.Image` class can now be created from a ``pathlib.Path`` object
(!292).
* Some functions in the :mod:`.path` module can now be used with
``pathlib.Path`` objects (!293).
Deprecated
^^^^^^^^^^
* Deprecated a number of GUI-specific properties in the
:mod:`fsl.utils.platform` module, including ``frozen``, ``haveGui``,
``canHaveGui``, ``inSSHSession``, ``inVNCSession``, ``wxPlatform``,
``wxFlavour``, ``glVersion``, ``glRenderer``, and ``glIsSoftwareRenderer``.
Equivalent functions are being added to the ``fsleyes-widgets`` library
(!285).
* The :mod:`fsl.utils.filetree` package has been deprecated, and will be
removed in a future version of ``fslpy`` - it is now published as a separate
library on [PyPI](https://pypi.org/project/file-tree/) (!286).
Fixed
^^^^^
* Fixed an edge-case in the :mod:`.gifti` module, where a surface with a
single triangle was being loaded incorrectly (!288).
* Fixed an issue in the :func:`~.fslsub.func_to_cmd` function, where it was
unintentionally leaving flie handles open (!291).
3.5.3 (Tuesday 9th February 2021)
---------------------------------
Fixed
^^^^^
* Fixed a bug in :func:`.featanalysis.loadClusterResults` (!281).
3.5.2 (Friday 29th January 2021)
---------------------------------
Fixed
^^^^^
* Adjusted the :func:`.dicom.scanDir` function so that it will set a
default value for ``SeriesDescription`` if it is not present in the
``dcm2niix`` ``json`` output (!279).
* Fixed some issues with API documentation generation (!279).
3.5.1 (Thursday 21st January 2021)
----------------------------------
Added
^^^^^
* New :func:`.featanalysis.loadFsf` function, for loading arbitrary ``.fsf``
files (!276).
Fixed
^^^^^
* Adjustments to :mod:`.dicom` tests to work with different versions of
``dcm2niix`` (!277).
3.5.0 (Wednesday 20th January 2021)
-----------------------------------
Added
^^^^^
* New ``fsl_anat.tree``, for use with the :mod:`~fsl.utils.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)
---------------------------------
Added
^^^^^
* New :mod:`.tbss` wrapper functions for `TBSS
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/TBSS>`_ commands.
Changed
^^^^^^^
* Calls to functions in the :mod:`.assertions` module are disabled when a
wrapper function is called with ``cmdonly=True``.
3.3.3 (Wednesday 13th October 2020)
-----------------------------------
Changed
^^^^^^^
* The :func:`.fileOrImage` (and related) decorators will not manipulate the
return value of a decorated function if an argument ``cmdonly=True`` is
passed. This is so that wrapper functions will directly return the command
that would be executed when ``cmdonly=True``.
3.3.2 (Tuesday 12th October 2020)
---------------------------------
Changed
^^^^^^^
* Most :func:`.wrapper` functions now accept an argument called ``cmdonly``
which, if ``True``, will cause the generated command-line call to be
returned, instead of executed.
3.3.1 (Thursday 8th October 2020)
---------------------------------
Changed
^^^^^^^
* The :func:`.affine.decompose` and :func:`.affine.compose` functions now
have the ability to return/accept shear components.
Fixed
^^^^^
* Fixed a bug in the :func:`.affine.decompose` function which was corrupting
the scale estimates when given an affine containing shears.
3.3.0 (Tuesday 22nd September 2020)
-----------------------------------
Added
^^^^^
* New ported versions of various core FSL tools, including ``imrm``, ``imln``,
``imtest``, ``fsl_abspath``, ``remove_ext``, ``Text2Vest``, and
``Vest2Text``.
* New :func:`.gps` function, wrapping the FSL ``gps`` command.
* New :func:`.vest.loadVestFile` and :func:`.vest.generateVest` functions.
Changed
^^^^^^^
* Updates to the BIDS filetree specification.
Fixed
^^^^^
* The :class:`.CoefficientField` class now works with alternate reference
images (i.e. a reference image with different dimensions to that which
was originally used when the non-linear transformation was calculated).
3.2.2 (Thursday 9th July 2020)
------------------------------
Changed
^^^^^^^
* The :func:`.fslsub.func_to_cmd` function allows more fine-grained control
over whether the script file is removed after the job has finished running.
3.2.1 (Tuesday 23rd June 2020)
------------------------------
Changed
^^^^^^^
* Minor updates to documentation.
3.2.0 (Thursday 11th June 2020)
-------------------------------
Added
^^^^^
* A new :func:`.fslsub.hold` function to wait on previously submitted jobs, to
be used in place of the ``wait`` function.
Removed
^^^^^^^
* The :func:`.fslsub.wait` (and :func:`.run.wait`) function has been removed, as
repeated calls to ``qstat`` can adversely affect the cluster job submission
system.
3.1.0 (Thursday 21st May 2020)
------------------------------
Added
^^^^^
* New :mod:`.cifti` module, providing classes and functions for working with
`CIFTI <https://www.nitrc.org/projects/cifti/>`_ data.
* New :func:`.winpath` and :func:`wslpath` functions for working with paths
when using FSL in a Windows Subsystem for Linux (WSL) environment.
* New :func:`.wslcmd` function for generating a path to a FSL command installed
in a WSL environment.
* New :meth:`.Platform.fslwsl` attribute for detecting whether FSL is installed
in a WSL environment.
* New :meth:`.Image.niftiDataType` property.
* The :class:`.FileTree` class has been updated to allow creation of
deep copies via the new :meth:`.FileTree.copy` method.
Changed
^^^^^^^
* :func:`.Image` objects created from ``numpy`` arrays will be NIFTI1 or
NIFTI2, depending on the value of the ``$FSLOUTPUTTYPE`` environment
variable.
Fixed
^^^^^
* Updated the :func:`.fast` wrapper to support some single-character
command-line flags.
3.0.1 (Wednesday 15th April 2020)
---------------------------------
Changed
^^^^^^^
* The :func:`.isMelodicDir` function now accepts directories that do not end
with ``.ica``, as long as all required files are present.
* Added the ``dataclasses`` backport, so ``fslpy`` is now compatible with
Python 3.6 again.
3.0.0 (Sunday 29th March 2020)
------------------------------
Added
^^^^^
* New wrapper functions for the FSL :class:`.fslstats`, :func:`.prelude` and
:func:`applyxfm4D` commands.
* New ``firstDot`` option to the :func:`.path.getExt`,
:func:`.path.removeExt`, and :func:`.path.splitExt`, functions, offering
rudimentary support for double-barrelled filenames.
* The :func:`.nonlinear.applyDeformation` function now accepts a ``premat``
affine, which is applied to the input image before the deformation field.
* New :class:`.SubmitParams` class, providing a higer level interface for
cluster submission.
* New :meth:`.FileTree.load_json` and :meth:`.FileTree.save_json` methods.
Changed
^^^^^^^
* ``fslpy`` now requires a minimum Python version of 3.7.
* The default value for the ``partial_fill`` option to :meth:`.FileTree.read`
has been changed to ``False``. Accordingly, the :class:`.FileTreeQuery`
calls the :meth:`.FileTree.partial_fill` method on the ``FileTree`` it is
given.
* The :func:`.gifti.relatedFiles` function now supports files with
BIDS-style naming conventions.
* The :func:`.run.run` and :func:`.run.runfsl` functions now pass through any
additional keyword arguments to ``subprocess.Popen`` or, if ``submit=True``,
to :func:`fslsub.submit`.
* The :func:`.fslsub.submit` function now accepts an ``env`` option, allowing
environment variables to be specified.
* The :func:`.run.runfsl` function now raises an error on attempts to
run a command which is not present in ``$FSLDIR/bin/`` (e.g. ``ls``).
* The :mod:`.bids` module has been updated to support files with any
extension, not just those in the core BIDS specification (``.nii``,
``.nii.gz``, ``.json``, ``.tsv``).
* The return value of a function decorated with :func:`.fileOrImage`,
:func:`.fileOrArray`, or :func:`.fileOrText` is now accessed via an attribute
called ``stdout``, instead of ``output``.
* Output files of functions decorated with :func:`.fileOrImage`,
:func:`.fileOrArray`, or :func:`.fileOrText`, which have been loaded via the
:attr:`.LOAD` symbol, can now be accessed as attributes of the returned
results object, in addition to being accessed as dict items.
* Wrapper functions decorated with the :func:`.fileOrImage`,
:func:`.fileOrArray`, or :func:`.fileOrText` decorators will now pass all
arguments and return values through unchanged if an argument called ``submit``
is passed in, and is set to ``True`` (or any non-``False``
value). Furthermore, in such a scenario a :exc:`ValueError` will be raised if
any in-memory objects or ``LOAD`` symbols are passed.
* The :func:`.fileOrText` decorator has been updated to work with input
values - file paths must be passed in as ``pathlib.Path`` objects, so they
can be differentiated from input values.
* Loaded :class:`.Image` objects returned by :mod:`fsl.wrappers` functions
are now named according to the wrapper function argument name.
Fixed
^^^^^
* Updated the :func:`.prepareArgs` function to use ``shlex.split`` when
preparing shell command arguments, instead of performing a naive whitespace
split.
* Fixed some bugs in the :func:`.fslsub.info` and :func:`.fslinfo.wait`
functions.
* Fixed the :func:`.DeformationField.transform` method so it works with
a single set of coordinates.
* :class:`.Image` creation does not fail if ``loadMeta`` is set, and a
sidecar file containing invalid JSON is present.
Removed
^^^^^^^
* Removed the deprecated ``.StatisticAtlas.proportions``,
``.StatisticAtlas.coordProportions``, and
``.StatisticAtlas.maskProportions`` methods.
* Removed the deprecated ``indexed`` option to :meth:`.Image.__init__`.
* Removed the deprecated ``.Image.resample`` method.
* Removed the deprecated ``.image.loadIndexedImageFile`` function.
* Removed the deprecatd ``.FileTreeQuery.short_names`` and
``.Match.short_name`` properties.
* Removed the deprecated ``.idle.inIdle``, ``.idle.cancelIdle``,
``.idle.idleReset``, ``.idle.getIdleTimeout``, and
``.idle.setIdleTimeout`` functions.
* Removed the deprecated ``resample.calculateMatrix`` function.
2.8.4 (Monday 2nd March 2020)
-----------------------------
Added
^^^^^
* Added a new ``partial_fill`` option to :meth:`.FileTree.read`, which
effectively eliminates any variables which only have one value. This was
added to accommodate some behavioural changes that were introduced in 2.8.2.
2.8.3 (Friday 28th February 2020)
---------------------------------
......@@ -175,8 +1436,8 @@ Changed
* The :class:`.Cache` class has a new ``lru`` option, allowing it to be used
as a least-recently-used cache.
* The :mod:`.filetree` module has been refactored to make it easier for the
:mod:`.query` module to work with file tree hierarchies.
* The :mod:`fsl.utils.filetree` module has been refactored to make it easier
for the :mod:`.query` module to work with file tree hierarchies.
* The :meth:`.LabelAtlas.get` method has a new ``binary`` flag, allowing
either a binary mask, or a mask with the original label value, to be
returned.
......@@ -351,8 +1612,8 @@ Added
^^^^^
* New tensor conversion routines in the :mod:`.dtifit` module (Michiel
Cottaar).
* New tensor conversion routines in the :mod:`~fsl.data.dtifit` module
(Michiel Cottaar).
* New :func:`.makeWriteable` function which ensures that a ``numpy.array`` is
writeable, and creates a copy if necessary
......
Copyright 2016-2020 University of Oxford, Oxford, UK
Copyright 2016-2023 University of Oxford, Oxford, UK
The fslpy library
Copyright 2016-2020 University of Oxford, Oxford, UK.
Copyright 2016-2023 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.
......
include AUTHOR
include LICENSE
include COPYRIGHT
include CHANGELOG.rst
include COPYRIGHT
include LICENSE
include README.rst
include requirements.txt
include requirements-dev.txt
include requirements-extra.txt
include setup.cfg
recursive-include doc *
recursive-exclude doc/html *
recursive-include tests *
include conftest.py
recursive-include doc *
recursive-include fsl/tests *
......@@ -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.10, 3.11, 3.12, and 3.13.
Installation
......@@ -41,11 +41,10 @@ Dependencies
All of the core dependencies of ``fslpy`` are listed in the
`requirements.txt <requirements.txt>`_ file.
`pyproject.toml <pyproject.toml>`_ file.
Some extra dependencies are listed in
`requirements-extra.txt <requirements-extra.txt>`_
which provide addditional functionality:
Some optional dependencies (labelled ``extra`` in ``pyproject.toml``) provide
addditional functionality:
- ``wxPython``: The `fsl.utils.idle <fsl/utils/idle.py>`_ module has
functionality to schedule functions on the ``wx`` idle loop.
......@@ -70,13 +69,13 @@ specific platform::
Once wxPython has been installed, you can type the following to install the
rest of the extra dependencies::
remaining optional dependencies::
pip install fslpy[extras]
pip install "fslpy[extra]"
Dependencies for testing and documentation are listed in the
`requirements-dev.txt <requirements-dev.txt>`_ file.
Dependencies for testing and documentation are also listed in ``pyproject.toml``,
and are respectively labelled as ``test`` and ``doc``.
Non-Python dependencies
......@@ -98,13 +97,16 @@ The `fsl.transform.x5 <fsl/transform/x5.py>`_ module uses `h5py
Documentation
-------------
API documentation for ``fslpy`` is hosted at
https://open.win.ox.ac.uk/pages/fsl/fslpy/.
``fslpy`` is documented using `sphinx <http://http://sphinx-doc.org/>`_. You
can build the API documentation by running::
pip install -r requirements-dev.txt
python setup.py doc
pip install ".[doc]"
sphinx-build doc html
The HTML documentation will be generated and saved in the ``doc/html/``
The HTML documentation will be generated and saved in the ``html/``
directory.
......@@ -113,11 +115,15 @@ Tests
Run the test suite via::
pip install -r requirements-dev.txt
python setup.py test
pip install ".[test]"
pytest
A test report will be generated at ``report.html``, and a code coverage report
will be generated in ``htmlcov/``.
Some tests will only pass if the test environment meets certain criteria -
refer to the ``tool.pytest.init_options`` section of
[``pyproject.toml``](pyproject.toml) for a list of [pytest
marks](https://docs.pytest.org/en/7.1.x/example/markers.html) which can be
selectively enabled or disabled.
Contributing
......
......@@ -14,12 +14,6 @@ import numpy as np
def pytest_addoption(parser):
parser.addoption('--niters',
type=int,
action='store',
default=50,
help='Number of test iterations for imagewrapper')
parser.addoption('--testdir',
action='store',
help='FSLeyes test data directory')
......@@ -29,11 +23,6 @@ def pytest_addoption(parser):
help='Seed for random number generator')
@pytest.fixture
def niters(request):
"""Number of test iterations."""
return request.config.getoption('--niters')
@pytest.fixture
def seed(request):
......
......@@ -12,12 +12,70 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import glob
import itertools as it
import os
import os.path as op
import sys
import datetime
date = datetime.date.today()
def check_for_missing_stubs():
docdir = op.dirname(__file__)
basedir = op.join(docdir, '..')
modules = []
def tomodname(f):
if f.endswith('.py'):
f = f[:-3]
return op.relpath(op.join(dirpath, f), basedir).replace(op.sep, '.')
for dirpath, dirnames, filenames in os.walk(op.join(basedir, 'fsl')):
for d in dirnames:
if d == '__pycache__':
continue
if len(glob.glob(op.join(dirpath, d, '**', '*.py'), recursive=True)) == 0:
continue
modules.append(tomodname(d))
for f in filenames:
if not f.endswith('.py'):
continue
if f in ('__init__.py', '__main__.py'):
continue
modules.append(tomodname(f))
modules = [m for m in modules if not m.startswith('fsl.tests')]
# import fsl
# modules = recurse(fsl)
# modules = [m.name for m in modules]
# print()
# print()
# print()
for mod in modules:
docfile = op.join(docdir, f'{mod}.rst')
if not op.exists(docfile):
print(f'No doc file found for module: {mod}')
for docfile in glob.glob(op.join(docdir, '*.rst')):
docfile = op.relpath(docfile, basedir)
mod = op.splitext(op.basename(docfile))[0]
if mod not in modules:
print(f'No module found for doc file: {docfile}')
if __name__ == '__main__':
check_for_missing_stubs()
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
......@@ -56,7 +114,7 @@ master_doc = 'index'
# General information about the project.
project = u'fslpy'
copyright = u'{}, Paul McCarthy, University of Oxford, Oxford, UK'.format(
copyright = u'{}, FMRIB Centre, University of Oxford, Oxford, UK'.format(
date.year)
# Links to other things
......@@ -152,11 +210,9 @@ html_theme = 'sphinx_rtd_theme'
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_context = {
'css_files': [
'_static/theme_overrides.css', # overrides for wide tables in RTD theme
],
}
html_css_files = [
'theme_overrides.css', # overrides for wide tables in RTD theme
]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
......@@ -361,26 +417,12 @@ epub_exclude_files = ['search.html']
# special-members flag)
autoclass_content = 'class'
# Document private members and special members (e.g. __init__)
autodoc_default_flags = ['private-members', 'special-members']
# Documentation for python modules is in the same order
# as the source code.
autodoc_member_order = 'bysource'
def autodoc_skip_member(app, what, name, obj, skip, options):
# Do not document the _sync_* properties
# that are added by the props package to
# all SyncableHasProperties classes.
if what == 'class':
attName = name.split('.')[-1]
return skip or attName.startswith('_sync_')
return skip or False
def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member)
autodoc_default_options = {
'special-members' : True,
'private-members' : True,
'undoc-members' : True,
'member-order' : 'bysource',
}
graphviz_output_format = 'svg'
......@@ -9,10 +9,10 @@ Development model
-----------------
- The master branch should always be stable and ready to release. All
development occurs on the master branch.
- The main branch should always be stable and ready to release. All
development occurs on the main branch.
- All changes to the master branch occur via merge requests. Individual
- All changes to the main branch occur via merge requests. Individual
developers are free to choose their own development workflow in their own
repositories.
......@@ -66,7 +66,7 @@ numbers::
backwards-incompatible changes.
The version number in the ``master`` branch should be of the form
The version number in the ``main`` branch should be of the form
``major.minor.patch.dev0``, to indicate that any releases made from this
branch are development releases (although development releases are not part of
the release model).
......@@ -83,7 +83,7 @@ name for minor release ``1.0`` would be ``v1.0``.
Patches and bugfixes may be added to these release branches as ``patch``
releases. These changes should be made on the master branch like any other
releases. These changes should be made on the main branch like any other
change (i.e. via merge requests), and then cherry-picked onto the relevant
release branch(es).
......@@ -99,17 +99,17 @@ Major/minor releases
Follow this process for major and minor releases. Steps 1 and 2 should be
performed via a merge request onto the master branch, and step 4 via a merge
performed via a merge request onto the main branch, and step 4 via a merge
request onto the relevant minor branch.
1. Update the changelog on the master branch to include the new version number
1. Update the changelog on the main branch to include the new version number
and release date.
2. On the master branch, update the version number in ``fsl/version.py`` to
2. On the main branch, update the version number in ``fsl/version.py`` to
a development version of **the next** minor release number. For example,
if you are about to release version ``1.3.0``, the version in the master
if you are about to release version ``1.3.0``, the version in the main
branch should be ``1.4.0.dev0``.
3. Create the new minor release branch off the master branch.
3. Create the new minor release branch off the main branch.
4. Update the version number on the release branch. If CI tests fail on the
release branch, postpone the release until they are fixed.
5. Tag the new release on the minor release branch.
......@@ -120,13 +120,13 @@ Bugfix/patch releases
Follow this process for patch releases. Step 1 should be performed via
a merge request onto the master branch, and step 2 via a merge request onto
a merge request onto the main branch, and step 2 via a merge request onto
the relevant minor branch.
1. Add the fix to the master branch, along with an updated changelog including
1. Add the fix to the main branch, along with an updated changelog including
the version number and date for the bugfix release.
2. Cherry-pick the relevant commit(s) from the master branch onto the minor
2. Cherry-pick the relevant commit(s) from the main branch onto the minor
release branch, and update the version number on the minor release branch.
If CI tests fail on the release branch, go back to step 1.
3. Tag the new release on the minor release branch.
......
``fsl.data.cifti``
==================
.. automodule:: fsl.data.cifti
:members:
:undoc-members:
:show-inheritance:
......@@ -6,6 +6,7 @@
fsl.data.atlases
fsl.data.bitmap
fsl.data.cifti
fsl.data.constants
fsl.data.dicom
fsl.data.dtifit
......
``fsl``
=======
.. toctree::
:hidden:
fsl.data
fsl.scripts
fsl.utils
fsl.transform
fsl.version
fsl.wrappers
.. automodule:: fsl
:members:
:undoc-members:
:show-inheritance:
``fsl.scripts.Text2Vest``
=========================
.. automodule:: fsl.scripts.Text2Vest
:members:
:undoc-members:
:show-inheritance: