Commit 462bff2f authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rel/3.5.1' into 'v3.5'

Rel/3.5.1

See merge request fsl/fslpy!278
parents 9f467c88 e1225806
Pipeline #7047 passed with stages
in 1 minute and 24 seconds
......@@ -2,6 +2,26 @@ This document contains the ``fslpy`` release history in reverse chronological
order.
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)
-----------------------------------
......
......@@ -22,6 +22,7 @@ following functions are provided:
isFirstLevelAnalysis
loadDesign
loadContrasts
loadFsf
loadSettings
getThresholds
loadClusterResults
......@@ -216,17 +217,16 @@ def loadContrasts(featdir):
return names, contrasts
def loadSettings(featdir):
"""Loads the analysis settings from a FEAT directory.
def loadFsf(designfsf):
"""Loads the analysis settings from a text file (.fsf) used to configure
FEAT.
Returns a dict containing the settings specified in the ``design.fsf``
file within the directory
Returns a dict containing the settings specified in the file
:arg featdir: A FEAT directory.
:arg designfsf: A .fsf file.
"""
settings = collections.OrderedDict()
designfsf = op.join(featdir, 'design.fsf')
log.debug('Loading FEAT settings from {}'.format(designfsf))
......@@ -251,6 +251,20 @@ def loadSettings(featdir):
return settings
def loadSettings(featdir):
"""Loads the analysis settings from a FEAT directory.
Returns a dict containing the settings specified in the ``design.fsf``
file within the directory
:arg featdir: A FEAT directory.
"""
designfsf = op.join(featdir, 'design.fsf')
return loadFsf(designfsf)
def loadDesign(featdir, settings):
"""Loads the design matrix from a FEAT directory.
......
......@@ -47,7 +47,7 @@ import re
import string
__version__ = '3.5.0'
__version__ = '3.5.1'
"""Current version number, as a string. """
......
......@@ -130,7 +130,8 @@ def test_scanDir():
for s in series:
assert s['PatientName'] in ('MCCARTHY_PAUL',
'MCCARTHY^PAUL',
'MCCARTHY_PAUL_2')
'MCCARTHY_PAUL_2',
'MCCARTHY^PAUL^2')
def test_sersiesCRC():
......@@ -183,11 +184,13 @@ def test_loadSeries():
assert img[:].shape == expShape
assert img.getMeta('PatientName') in ('MCCARTHY_PAUL',
'MCCARTHY^PAUL',
'MCCARTHY_PAUL_2')
'MCCARTHY_PAUL_2',
'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()
('PatientName', 'MCCARTHY_PAUL_2') in img.metaItems() or \
('PatientName', 'MCCARTHY^PAUL^2') in img.metaItems()
......@@ -240,9 +240,10 @@ def test_loadSettings():
with tests.testdir() as testdir:
featdir = op.join(testdir, 'analysis.feat')
tests.make_dummy_file(op.join(featdir, 'design.fsf'), contents)
result = featanalysis.loadSettings(featdir)
assert result == expected
designfsf = op.join(featdir, 'design.fsf')
tests.make_dummy_file(designfsf, contents)
assert featanalysis.loadSettings(featdir) == expected
assert featanalysis.loadFsf(designfsf) == expected
def test_loadDesign():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment