diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1c48afb290e11342d6ae3ddb746e2113fd736ba3..b588b89276fa4b45a0dea6e5b416d5fa373e3bbe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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) ----------------------------------- diff --git a/fsl/data/featanalysis.py b/fsl/data/featanalysis.py index a8aa25f097d3b20e97fa5f74e4542fa887b09608..473e5662334ee8e329ff8986ccbe3240b8e374ff 100644 --- a/fsl/data/featanalysis.py +++ b/fsl/data/featanalysis.py @@ -22,6 +22,7 @@ following functions are provided: isFirstLevelAnalysis loadDesign loadContrasts + loadFsf loadSettings getThresholds loadClusterResults @@ -215,16 +216,18 @@ def loadContrasts(featdir): return names, contrasts + def loadFsf(designfsf): - """Loads the analysis settings from a text file (.fsf) used to configure FEAT. + """Loads the analysis settings from a text file (.fsf) used to configure + FEAT. Returns a dict containing the settings specified in the file :arg designfsf: A .fsf file. """ - + settings = collections.OrderedDict() - + log.debug('Loading FEAT settings from {}'.format(designfsf)) with open(designfsf, 'rt') as f: @@ -247,6 +250,7 @@ def loadFsf(designfsf): return settings + def loadSettings(featdir): """Loads the analysis settings from a FEAT directory. @@ -255,9 +259,9 @@ def loadSettings(featdir): :arg featdir: A FEAT directory. """ - + designfsf = op.join(featdir, 'design.fsf') - + return loadFsf(designfsf) diff --git a/tests/test_dicom.py b/tests/test_dicom.py index dba678f4868368b514968263f362dafa2759192f..50dc56e8cb976f09cd0bd75290893ace631b1d71 100644 --- a/tests/test_dicom.py +++ b/tests/test_dicom.py @@ -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()